summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-06-29 11:40:03 +0100
committerw0rp <devw0rp@gmail.com>2017-06-29 11:40:03 +0100
commit79e8e063af1cf7a72ec42075f4eed30aa69607e8 (patch)
treeeda18cb73dc90c5cd540cc8db63e14420f854b0c /test
parent01ecf2a75f60fff8884ad7858da44b3c5f71bc11 (diff)
downloadale-79e8e063af1cf7a72ec42075f4eed30aa69607e8.zip
Make pug-lint detect node_modules executables, and add options for pug-lint like the other linters
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/puglint_project/node_modules/.bin/pug-lint0
-rw-r--r--test/command_callback/puglint_project/package.json0
-rw-r--r--test/command_callback/puglint_project/puglint_rc_dir/.pug-lintrc0
-rw-r--r--test/command_callback/puglint_project/puglint_rc_js_dir/.pug-lintrc.js0
-rw-r--r--test/command_callback/puglint_project/puglint_rc_json_dir/.pug-lintrc.json0
-rw-r--r--test/command_callback/test_puglint_command_callback.vader72
6 files changed, 72 insertions, 0 deletions
diff --git a/test/command_callback/puglint_project/node_modules/.bin/pug-lint b/test/command_callback/puglint_project/node_modules/.bin/pug-lint
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/puglint_project/node_modules/.bin/pug-lint
diff --git a/test/command_callback/puglint_project/package.json b/test/command_callback/puglint_project/package.json
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/puglint_project/package.json
diff --git a/test/command_callback/puglint_project/puglint_rc_dir/.pug-lintrc b/test/command_callback/puglint_project/puglint_rc_dir/.pug-lintrc
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/puglint_project/puglint_rc_dir/.pug-lintrc
diff --git a/test/command_callback/puglint_project/puglint_rc_js_dir/.pug-lintrc.js b/test/command_callback/puglint_project/puglint_rc_js_dir/.pug-lintrc.js
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/puglint_project/puglint_rc_js_dir/.pug-lintrc.js
diff --git a/test/command_callback/puglint_project/puglint_rc_json_dir/.pug-lintrc.json b/test/command_callback/puglint_project/puglint_rc_json_dir/.pug-lintrc.json
new file mode 100644
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/puglint_project/puglint_rc_json_dir/.pug-lintrc.json
diff --git a/test/command_callback/test_puglint_command_callback.vader b/test/command_callback/test_puglint_command_callback.vader
new file mode 100644
index 00000000..830d63b3
--- /dev/null
+++ b/test/command_callback/test_puglint_command_callback.vader
@@ -0,0 +1,72 @@
+Before:
+ Save g:ale_pug_puglint_options
+ Save g:ale_pug_puglint_executable
+ Save g:ale_pug_puglint_use_global
+
+ let g:ale_pug_puglint_options = ''
+ let g:ale_pug_puglint_executable = 'pug-lint'
+ let g:ale_pug_puglint_use_global = 0
+
+ silent! cd /testplugin/test/command_callback
+ let g:dir = getcwd()
+
+ runtime ale_linters/pug/puglint.vim
+
+After:
+ Restore
+
+ silent execute 'cd ' . fnameescape(g:dir)
+ unlet! g:dir
+
+ call ale#linter#Reset()
+
+Execute(puglint should detect local executables and package.json):
+ call ale#test#SetFilename('puglint_project/test.pug')
+
+ AssertEqual
+ \ g:dir . '/puglint_project/node_modules/.bin/pug-lint',
+ \ ale_linters#pug#puglint#GetExecutable(bufnr(''))
+ AssertEqual
+ \ ale#Escape(g:dir . '/puglint_project/node_modules/.bin/pug-lint')
+ \ . ' -c ' . ale#Escape(g:dir . '/puglint_project/package.json')
+ \ . ' -r inline %t',
+ \ ale_linters#pug#puglint#GetCommand(bufnr(''))
+
+Execute(puglint should use global executables if configured):
+ let g:ale_pug_puglint_use_global = 1
+
+ call ale#test#SetFilename('puglint_project/test.pug')
+
+ AssertEqual 'pug-lint', ale_linters#pug#puglint#GetExecutable(bufnr(''))
+ AssertEqual
+ \ ale#Escape('pug-lint')
+ \ . ' -c ' . ale#Escape(g:dir . '/puglint_project/package.json')
+ \ . ' -r inline %t',
+ \ ale_linters#pug#puglint#GetCommand(bufnr(''))
+
+Execute(puglint should detect .pug-lintrc):
+ call ale#test#SetFilename('puglint_project/puglint_rc_dir/subdir/test.pug')
+
+ AssertEqual
+ \ ale#Escape(g:dir . '/puglint_project/node_modules/.bin/pug-lint')
+ \ . ' -c ' . ale#Escape(g:dir . '/puglint_project/puglint_rc_dir/.pug-lintrc')
+ \ . ' -r inline %t',
+ \ ale_linters#pug#puglint#GetCommand(bufnr(''))
+
+Execute(puglint should detect .pug-lintrc.js):
+ call ale#test#SetFilename('puglint_project/puglint_rc_js_dir/subdir/test.pug')
+
+ AssertEqual
+ \ ale#Escape(g:dir . '/puglint_project/node_modules/.bin/pug-lint')
+ \ . ' -c ' . ale#Escape(g:dir . '/puglint_project/puglint_rc_js_dir/.pug-lintrc.js')
+ \ . ' -r inline %t',
+ \ ale_linters#pug#puglint#GetCommand(bufnr(''))
+
+Execute(puglint should detect .pug-lintrc.json):
+ call ale#test#SetFilename('puglint_project/puglint_rc_json_dir/subdir/test.pug')
+
+ AssertEqual
+ \ ale#Escape(g:dir . '/puglint_project/node_modules/.bin/pug-lint')
+ \ . ' -c ' . ale#Escape(g:dir . '/puglint_project/puglint_rc_json_dir/.pug-lintrc.json')
+ \ . ' -r inline %t',
+ \ ale_linters#pug#puglint#GetCommand(bufnr(''))