diff options
author | w0rp <devw0rp@gmail.com> | 2018-07-15 18:24:53 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-07-15 18:28:28 +0100 |
commit | a42999a639b2916b769a85f37d037be314d9d61b (patch) | |
tree | 5ebfb4d357dc673efa93fd32a66b489c4510de40 /test/command_callback/test_less_stylelint_command_callback.vader | |
parent | 5155a35a80fe3b20659eb0f28cc6cc720532dd3f (diff) | |
download | ale-a42999a639b2916b769a85f37d037be314d9d61b.zip |
Massively reduce the amount of code needed for linter tests
Diffstat (limited to 'test/command_callback/test_less_stylelint_command_callback.vader')
-rw-r--r-- | test/command_callback/test_less_stylelint_command_callback.vader | 41 |
1 files changed, 6 insertions, 35 deletions
diff --git a/test/command_callback/test_less_stylelint_command_callback.vader b/test/command_callback/test_less_stylelint_command_callback.vader index a5912ecf..8d23deb6 100644 --- a/test/command_callback/test_less_stylelint_command_callback.vader +++ b/test/command_callback/test_less_stylelint_command_callback.vader @@ -1,31 +1,10 @@ Before: - Save g:ale_less_stylelint_executable - Save g:ale_less_stylelint_use_global - Save g:ale_less_stylelint_options - + call ale#assert#SetUpLinterTest('less', 'stylelint') 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() + call ale#assert#TearDownLinterTest() Execute(node_modules directories should be discovered): call ale#test#SetFilename('stylelint_paths/nested/testfile.less') @@ -35,10 +14,7 @@ Execute(node_modules directories should be discovered): \ . '/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('')) + AssertLinter b:executable, ale#Escape(b:executable) . ' --stdin-filename %s' Execute(The global override should work): let b:ale_less_stylelint_executable = 'foobar' @@ -46,15 +22,10 @@ Execute(The global override should work): 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('')) + AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin-filename %s' 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('')) + AssertLinter 'stylelint', + \ ale#Escape('stylelint') . ' --whatever --stdin-filename %s' |