diff options
author | w0rp <devw0rp@gmail.com> | 2017-11-12 12:09:19 +0000 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2017-11-12 12:09:19 +0000 |
commit | 3c34848e0296ca51b35fe15152c11ff7f32a3a72 (patch) | |
tree | c65c6906966305934d0a4c28d3e1030864578e79 /test | |
parent | 5b3094558bb8e890404c2ea8e65f0fc9a520a322 (diff) | |
download | ale-3c34848e0296ca51b35fe15152c11ff7f32a3a72.zip |
Fix #510 Support checking LESS files with stylelint
Diffstat (limited to 'test')
-rwxr-xr-x | test/command_callback/stylelint_paths/node_modules/.bin/stylelint | 0 | ||||
-rw-r--r-- | test/command_callback/test_less_stylelint_command_callback.vader | 60 |
2 files changed, 60 insertions, 0 deletions
diff --git a/test/command_callback/stylelint_paths/node_modules/.bin/stylelint b/test/command_callback/stylelint_paths/node_modules/.bin/stylelint new file mode 100755 index 00000000..e69de29b --- /dev/null +++ b/test/command_callback/stylelint_paths/node_modules/.bin/stylelint diff --git a/test/command_callback/test_less_stylelint_command_callback.vader b/test/command_callback/test_less_stylelint_command_callback.vader new file mode 100644 index 00000000..d5aa3b97 --- /dev/null +++ b/test/command_callback/test_less_stylelint_command_callback.vader @@ -0,0 +1,60 @@ +Before: + Save g:ale_less_stylelint_executable + Save g:ale_less_stylelint_use_global + Save g:ale_less_stylelint_options + + unlet! b:executable + + unlet! g:ale_less_stylelint_executable + unlet! g:ale_less_stylelint_use_global + unlet! g:ale_less_stylelint_options + + call ale#test#SetDirectory('/testplugin/test/command_callback') + call ale#test#SetFilename('testfile.less') + + runtime ale_linters/less/stylelint.vim + +After: + Restore + + unlet! b:executable + unlet! b:ale_less_stylelint_executable + unlet! b:ale_less_stylelint_use_global + unlet! b:ale_less_stylelint_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('stylelint_paths/nested/testfile.less') + + let b:executable = ale#path#Winify( + \ g:dir + \ . '/stylelint_paths/node_modules/.bin/stylelint' + \) + + AssertEqual b:executable, ale_linters#less#stylelint#GetExecutable(bufnr('')) + AssertEqual + \ ale#Escape(b:executable) . ' --stdin-filename %s', + \ ale_linters#less#stylelint#GetCommand(bufnr('')) + +Execute(The global override should work): + let b:ale_less_stylelint_executable = 'foobar' + let b:ale_less_stylelint_use_global = 1 + + call ale#test#SetFilename('stylelint_paths/nested/testfile.less') + + AssertEqual 'foobar', ale_linters#less#stylelint#GetExecutable(bufnr('')) + AssertEqual + \ ale#Escape('foobar') . ' --stdin-filename %s', + \ ale_linters#less#stylelint#GetCommand(bufnr('')) + +Execute(Extra options should be configurable): + let b:ale_less_stylelint_options = '--whatever' + + AssertEqual 'stylelint', ale_linters#less#stylelint#GetExecutable(bufnr('')) + AssertEqual + \ ale#Escape('stylelint') . ' --whatever --stdin-filename %s', + \ ale_linters#less#stylelint#GetCommand(bufnr('')) |