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_pyrex_cython_command_callback.vader | 36 +++++----------------- 1 file changed, 8 insertions(+), 28 deletions(-) (limited to 'test/command_callback/test_pyrex_cython_command_callback.vader') diff --git a/test/command_callback/test_pyrex_cython_command_callback.vader b/test/command_callback/test_pyrex_cython_command_callback.vader index 527ed2dd..b9020f11 100644 --- a/test/command_callback/test_pyrex_cython_command_callback.vader +++ b/test/command_callback/test_pyrex_cython_command_callback.vader @@ -1,50 +1,30 @@ Before: - Save g:ale_pyrex_cython_executable - Save g:ale_pyrex_cython_options - - unlet! g:ale_pyrex_cython_executable - unlet! b:ale_pyrex_cython_executable - unlet! g:ale_pyrex_cython_options - unlet! b:ale_pyrex_cython_options - - runtime ale_linters/pyrex/cython.vim - - call ale#test#SetDirectory('/testplugin/test/command_callback') + call ale#assert#SetUpLinterTest('pyrex', 'cython') After: - Restore - unlet! b:ale_pyrex_cython_options - unlet! b:ale_pyrex_cython_executable - call ale#linter#Reset() - call ale#test#RestoreDirectory() + call ale#assert#TearDownLinterTest() Execute(The default cython command should be correct): - AssertEqual - \ ale#Escape('cython') + AssertLinter 'cython', ale#Escape('cython') \ . ' --working ' . ale#Escape(g:dir) \ . ' --include-dir ' . ale#Escape(g:dir) \ . ' --warning-extra' - \ . ' --output-file ' . g:ale#util#nul_file . ' %t', - \ ale_linters#pyrex#cython#GetCommand(bufnr('')) + \ . ' --output-file ' . g:ale#util#nul_file . ' %t' Execute(The cython executable should be configurable): let b:ale_pyrex_cython_executable = 'cython_foobar' - AssertEqual - \ ale#Escape('cython_foobar') + AssertLinter 'cython_foobar', ale#Escape('cython_foobar') \ . ' --working ' . ale#Escape(g:dir) \ . ' --include-dir ' . ale#Escape(g:dir) \ . ' --warning-extra' - \ . ' --output-file ' . g:ale#util#nul_file . ' %t', - \ ale_linters#pyrex#cython#GetCommand(bufnr('')) + \ . ' --output-file ' . g:ale#util#nul_file . ' %t' Execute(Additional cython options should be configurable): let b:ale_pyrex_cython_options = '--foobar' - AssertEqual - \ ale#Escape('cython') + AssertLinter 'cython', ale#Escape('cython') \ . ' --working ' . ale#Escape(g:dir) \ . ' --include-dir ' . ale#Escape(g:dir) \ . ' --foobar' - \ . ' --output-file ' . g:ale#util#nul_file . ' %t', - \ ale_linters#pyrex#cython#GetCommand(bufnr('')) + \ . ' --output-file ' . g:ale#util#nul_file . ' %t' -- cgit v1.2.3