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_perlcritic_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_perlcritic_command_callback.vader')
-rw-r--r-- | test/command_callback/test_perlcritic_command_callback.vader | 57 |
1 files changed, 13 insertions, 44 deletions
diff --git a/test/command_callback/test_perlcritic_command_callback.vader b/test/command_callback/test_perlcritic_command_callback.vader index e8d8cc18..0f1e2856 100644 --- a/test/command_callback/test_perlcritic_command_callback.vader +++ b/test/command_callback/test_perlcritic_command_callback.vader @@ -1,67 +1,36 @@ Before: - Save g:ale_perl_perlcritic_profile - Save g:ale_perl_perlcritic_options - Save g:ale_perl_perlcritic_executable - Save g:ale_perl_perlcritic_showrules - - unlet! g:ale_perl_perlcritic_options - unlet! g:ale_perl_perlcritic_executable - unlet! g:ale_perl_perlcritic_showrules - let g:ale_perl_perlcritic_profile = '' - - runtime ale_linters/perl/perlcritic.vim - - call ale#test#SetDirectory('/testplugin/test/command_callback') + call ale#assert#SetUpLinterTest('perl', 'perlcritic') call ale#test#SetFilename('test.pl') + let g:ale_perl_perlcritic_profile = '' After: - Restore - - unlet! b:ale_perl_perlcritic_profile - unlet! b:ale_perl_perlcritic_options - unlet! b:ale_perl_perlcritic_executable - unlet! b:ale_perl_perlcritic_showrules unlet! b:readme_path - - call ale#test#RestoreDirectory() - call ale#linter#Reset() + call ale#assert#TearDownLinterTest() Execute(The command should be correct with g:ale_perl_perlcritic_showrules off): let b:ale_perl_perlcritic_showrules = 0 - AssertEqual - \ ale#Escape('perlcritic') - \ . ' --verbose ' . ale#Escape('%l:%c %m\n') - \ . ' --nocolor', - \ ale_linters#perl#perlcritic#GetCommand(bufnr('')) + AssertLinter 'perlcritic', ale#Escape('perlcritic') + \ . ' --verbose ' . ale#Escape('%l:%c %m\n') . ' --nocolor' Execute(The command should be correct with g:ale_perl_perlcritic_showrules on): let b:ale_perl_perlcritic_showrules = 1 - AssertEqual - \ ale#Escape('perlcritic') - \ . ' --verbose ' . ale#Escape('%l:%c %m [%p]\n') - \ . ' --nocolor', - \ ale_linters#perl#perlcritic#GetCommand(bufnr('')) + AssertLinter 'perlcritic', ale#Escape('perlcritic') + \ . ' --verbose ' . ale#Escape('%l:%c %m [%p]\n') . ' --nocolor' Execute(The command search for the profile file when set): let b:ale_perl_perlcritic_profile = 'README.md' let b:readme_path = ale#path#Simplify(expand('%:p:h:h:h') . '/README.md') - AssertEqual - \ ale#Escape('perlcritic') - \ . ' --verbose ' . ale#Escape('%l:%c %m\n') - \ . ' --nocolor' - \ . ' --profile ' . ale#Escape(b:readme_path), - \ ale_linters#perl#perlcritic#GetCommand(bufnr('')) + AssertLinter 'perlcritic', ale#Escape('perlcritic') + \ . ' --verbose ' . ale#Escape('%l:%c %m\n') . ' --nocolor' + \ . ' --profile ' . ale#Escape(b:readme_path) Execute(Extra options should be set appropriately): let b:ale_perl_perlcritic_options = 'beep boop' - AssertEqual - \ ale#Escape('perlcritic') - \ . ' --verbose ' . ale#Escape('%l:%c %m\n') - \ . ' --nocolor' - \ . ' beep boop', - \ ale_linters#perl#perlcritic#GetCommand(bufnr('')) + AssertLinter 'perlcritic', ale#Escape('perlcritic') + \ . ' --verbose ' . ale#Escape('%l:%c %m\n') . ' --nocolor' + \ . ' beep boop' |