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_mercury_mmc_command_callback.vader | 39 ++++++---------------- 1 file changed, 11 insertions(+), 28 deletions(-) (limited to 'test/command_callback/test_mercury_mmc_command_callback.vader') diff --git a/test/command_callback/test_mercury_mmc_command_callback.vader b/test/command_callback/test_mercury_mmc_command_callback.vader index 7ebf49c3..2948e799 100644 --- a/test/command_callback/test_mercury_mmc_command_callback.vader +++ b/test/command_callback/test_mercury_mmc_command_callback.vader @@ -1,42 +1,25 @@ Before: - Save g:ale_mercury_mmc_executable - Save g:ale_mercury_mmc_options - - unlet! g:ale_mercury_mmc_executable - unlet! b:ale_mercury_mmc_executable - unlet! g:ale_mercury_mmc_options - unlet! b:ale_mercury_mmc_options - - runtime ale_linters/mercury/mmc.vim - call ale#test#SetDirectory('/testplugin/test/command_callback') + call ale#assert#SetUpLinterTest('mercury', 'mmc') + call ale#test#SetFilename('dummy') After: - unlet! b:ale_mercury_mmc_executable - unlet! b:ale_mercury_mmc_options - - Restore - call ale#test#RestoreDirectory() - call ale#linter#Reset() + call ale#assert#TearDownLinterTest() Execute(The default command should be correct): - AssertEqual + AssertLinter 'mmc', \ ale#path#BufferCdString(bufnr('')) - \ . 'mmc --errorcheck-only --make --output-compile-error-lines 100 dummy', - \ - \ ale_linters#mercury#mmc#GetCommand(bufnr('')) + \ . 'mmc --errorcheck-only --make --output-compile-error-lines 100 dummy' Execute(The executable should be configurable): let b:ale_mercury_mmc_executable = 'foo' - AssertEqual + + AssertLinter 'foo', \ ale#path#BufferCdString(bufnr('')) - \ . 'foo --errorcheck-only --make --output-compile-error-lines 100 dummy', - \ - \ ale_linters#mercury#mmc#GetCommand(bufnr('')) + \ . 'foo --errorcheck-only --make --output-compile-error-lines 100 dummy' Execute(The options should be configurable): let b:ale_mercury_mmc_options = '--bar' - AssertEqual + + AssertLinter 'mmc', \ ale#path#BufferCdString(bufnr('')) - \ . 'mmc --errorcheck-only --bar dummy', - \ - \ ale_linters#mercury#mmc#GetCommand(bufnr('')) + \ . 'mmc --errorcheck-only --bar dummy' -- cgit v1.2.3