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_puglint_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_puglint_command_callback.vader')
-rw-r--r-- | test/command_callback/test_puglint_command_callback.vader | 47 |
1 files changed, 12 insertions, 35 deletions
diff --git a/test/command_callback/test_puglint_command_callback.vader b/test/command_callback/test_puglint_command_callback.vader index f9b4a856..69c86b25 100644 --- a/test/command_callback/test_puglint_command_callback.vader +++ b/test/command_callback/test_puglint_command_callback.vader @@ -1,71 +1,48 @@ 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 - - call ale#test#SetDirectory('/testplugin/test/command_callback') - - runtime ale_linters/pug/puglint.vim + call ale#assert#SetUpLinterTest('pug', 'puglint') After: - Restore - - call ale#test#RestoreDirectory() - call ale#linter#Reset() + call ale#assert#TearDownLinterTest() Execute(puglint should detect local executables and package.json): call ale#test#SetFilename('puglint_project/test.pug') - AssertEqual + AssertLinter \ ale#path#Simplify(g:dir . '/puglint_project/node_modules/.bin/pug-lint'), - \ ale_linters#pug#puglint#GetExecutable(bufnr('')) - - AssertEqual \ ale#Escape(ale#path#Simplify(g:dir . '/puglint_project/node_modules/.bin/pug-lint')) \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/puglint_project/package.json')) - \ . ' -r inline %t', - \ ale_linters#pug#puglint#GetCommand(bufnr('')) + \ . ' -r inline %t' 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 + AssertLinter 'pug-lint', \ ale#Escape('pug-lint') \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/puglint_project/package.json')) - \ . ' -r inline %t', - \ ale_linters#pug#puglint#GetCommand(bufnr('')) + \ . ' -r inline %t' Execute(puglint should detect .pug-lintrc): call ale#test#SetFilename('puglint_project/puglint_rc_dir/subdir/test.pug') - AssertEqual + AssertLinter ale#path#Simplify(g:dir . '/puglint_project/node_modules/.bin/pug-lint'), \ ale#Escape(ale#path#Simplify(g:dir . '/puglint_project/node_modules/.bin/pug-lint')) \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/puglint_project/puglint_rc_dir/.pug-lintrc')) - \ . ' -r inline %t', - \ ale_linters#pug#puglint#GetCommand(bufnr('')) + \ . ' -r inline %t' Execute(puglint should detect .pug-lintrc.js): call ale#test#SetFilename('puglint_project/puglint_rc_js_dir/subdir/test.pug') - AssertEqual + AssertLinter ale#path#Simplify(g:dir . '/puglint_project/node_modules/.bin/pug-lint'), \ ale#Escape(ale#path#Simplify(g:dir . '/puglint_project/node_modules/.bin/pug-lint')) \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/puglint_project/puglint_rc_js_dir/.pug-lintrc.js')) - \ . ' -r inline %t', - \ ale_linters#pug#puglint#GetCommand(bufnr('')) + \ . ' -r inline %t' Execute(puglint should detect .pug-lintrc.json): call ale#test#SetFilename('puglint_project/puglint_rc_json_dir/subdir/test.pug') - AssertEqual + AssertLinter ale#path#Simplify(g:dir . '/puglint_project/node_modules/.bin/pug-lint'), \ ale#Escape(ale#path#Simplify(g:dir . '/puglint_project/node_modules/.bin/pug-lint')) \ . ' -c ' . ale#Escape(ale#path#Simplify(g:dir . '/puglint_project/puglint_rc_json_dir/.pug-lintrc.json')) - \ . ' -r inline %t', - \ ale_linters#pug#puglint#GetCommand(bufnr('')) + \ . ' -r inline %t' |