From a42999a639b2916b769a85f37d037be314d9d61b Mon Sep 17 00:00:00 2001 From: w0rp Date: Sun, 15 Jul 2018 18:24:53 +0100 Subject: Massively reduce the amount of code needed for linter tests --- .../test_gawk_command_callback.vader | 43 +++++++--------------- 1 file changed, 14 insertions(+), 29 deletions(-) (limited to 'test/command_callback/test_gawk_command_callback.vader') diff --git a/test/command_callback/test_gawk_command_callback.vader b/test/command_callback/test_gawk_command_callback.vader index ae128fe5..6bc0a438 100644 --- a/test/command_callback/test_gawk_command_callback.vader +++ b/test/command_callback/test_gawk_command_callback.vader @@ -1,40 +1,25 @@ Before: - Save g:ale_awk_gawk_executable - Save g:ale_awk_gawk_options - unlet! g:ale_awk_gawk_executable - unlet! g:ale_awk_gawk_options - - runtime ale_linters/awk/gawk.vim + call ale#assert#SetUpLinterTest('awk', 'gawk') After: - Restore - unlet! b:command_tail - unlet! b:ale_awk_gawk_executable - unlet! b:ale_awk_gawk_options - - call ale#linter#Reset() + call ale#assert#TearDownLinterTest() -Execute(The executable should be used in the command): - AssertEqual - \ 'gawk' - \ . " --source 'BEGIN { exit } END { exit 1 }'" - \ . ' ' . '-f %t --lint /dev/null', - \ ale_linters#awk#gawk#GetCommand(bufnr('')) +Execute(The default command should be correct): + AssertLinter 'gawk', + \ ale#Escape('gawk') . ' --source ''BEGIN { exit } END { exit 1 }''' + \ . ' -f %t --lint /dev/null' +Execute(The executable should be configurable): let b:ale_awk_gawk_executable = '/other/gawk' - AssertEqual - \ '/other/gawk' - \ . " --source 'BEGIN { exit } END { exit 1 }'" - \ . ' ' . '-f %t --lint /dev/null', - \ ale_linters#awk#gawk#GetCommand(bufnr('')) + AssertLinter '/other/gawk', + \ ale#Escape('/other/gawk') . ' --source ''BEGIN { exit } END { exit 1 }''' + \ . ' -f %t --lint /dev/null' +Execute(The options should be configurable): let b:ale_awk_gawk_executable = 'gawk' let b:ale_awk_gawk_options = '--something' - AssertEqual - \ 'gawk' - \ . " --source 'BEGIN { exit } END { exit 1 }'" - \ . ' --something' - \ . ' ' . '-f %t --lint /dev/null', - \ ale_linters#awk#gawk#GetCommand(bufnr('')) + AssertLinter 'gawk', + \ ale#Escape('gawk') . ' --source ''BEGIN { exit } END { exit 1 }''' + \ . ' --something -f %t --lint /dev/null' -- cgit v1.2.3