summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2017-11-12 11:25:24 +0000
committerw0rp <devw0rp@gmail.com>2017-11-12 11:25:24 +0000
commitcd5da50531d55c003de495d8b151c60c5dbf26eb (patch)
tree58fa28991dce13335d3353af1e571b4214c6d6a9 /test
parent3aff1df9615ccc95bb91910f82d43947dd835f28 (diff)
downloadale-cd5da50531d55c003de495d8b151c60c5dbf26eb.zip
Add tests for the command and executable callbacks, and make them use local node_modulse esxecutables like other linters
Diffstat (limited to 'test')
-rwxr-xr-xtest/command_callback/lessc_paths/node_modules/.bin/lessc0
-rw-r--r--test/command_callback/test_lessc_command_callback.vader82
2 files changed, 82 insertions, 0 deletions
diff --git a/test/command_callback/lessc_paths/node_modules/.bin/lessc b/test/command_callback/lessc_paths/node_modules/.bin/lessc
new file mode 100755
index 00000000..e69de29b
--- /dev/null
+++ b/test/command_callback/lessc_paths/node_modules/.bin/lessc
diff --git a/test/command_callback/test_lessc_command_callback.vader b/test/command_callback/test_lessc_command_callback.vader
new file mode 100644
index 00000000..785c38c0
--- /dev/null
+++ b/test/command_callback/test_lessc_command_callback.vader
@@ -0,0 +1,82 @@
+Before:
+ Save g:ale_less_lessc_executable
+ Save g:ale_less_lessc_use_global
+ Save g:ale_less_lessc_options
+
+ unlet! b:executable
+
+ unlet! g:ale_less_lessc_executable
+ unlet! g:ale_less_lessc_use_global
+ unlet! g:ale_less_lessc_options
+
+ call ale#test#SetDirectory('/testplugin/test/command_callback')
+ call ale#test#SetFilename('testfile.less')
+
+ runtime ale_linters/less/lessc.vim
+
+After:
+ Restore
+
+ unlet! b:executable
+ unlet! b:ale_less_lessc_executable
+ unlet! b:ale_less_lessc_use_global
+ unlet! b:ale_less_lessc_options
+
+ call ale#test#SetFilename('test.txt')
+
+ call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
+
+Execute(node_modules directories should be discovered):
+ call ale#test#SetFilename('lessc_paths/nested/testfile.less')
+
+ let b:executable = ale#path#Winify(
+ \ g:dir
+ \ . '/lessc_paths/node_modules/.bin/lessc'
+ \)
+
+ AssertEqual
+ \ b:executable,
+ \ ale_linters#less#lessc#GetExecutable(bufnr(''))
+
+ AssertEqual
+ \ ale#Escape(b:executable)
+ \ . ' --no-color --lint'
+ \ . ' --include-path='
+ \ . ale#Escape(ale#path#Winify(g:dir . '/lessc_paths/nested'))
+ \ . ' -',
+ \ ale_linters#less#lessc#GetCommand(bufnr(''))
+
+Execute(The global override should work):
+ let b:ale_less_lessc_executable = 'foobar'
+ let b:ale_less_lessc_use_global = 1
+
+ call ale#test#SetFilename('lessc_paths/nested/testfile.less')
+
+ AssertEqual
+ \ 'foobar',
+ \ ale_linters#less#lessc#GetExecutable(bufnr(''))
+
+ AssertEqual
+ \ ale#Escape('foobar')
+ \ . ' --no-color --lint'
+ \ . ' --include-path='
+ \ . ale#Escape(ale#path#Winify(g:dir . '/lessc_paths/nested'))
+ \ . ' -',
+ \ ale_linters#less#lessc#GetCommand(bufnr(''))
+
+Execute(Extra options should be configurable):
+ let b:ale_less_lessc_options = '--whatever'
+
+ AssertEqual
+ \ 'lessc',
+ \ ale_linters#less#lessc#GetExecutable(bufnr(''))
+
+ AssertEqual
+ \ ale#Escape('lessc')
+ \ . ' --no-color --lint'
+ \ . ' --include-path='
+ \ . ale#Escape(ale#path#Winify(g:dir))
+ \ . ' --whatever'
+ \ . ' -',
+ \ ale_linters#less#lessc#GetCommand(bufnr(''))