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_cpplint_command_callbacks.vader | 35 ++++------------------ 1 file changed, 5 insertions(+), 30 deletions(-) (limited to 'test/command_callback/test_cpplint_command_callbacks.vader') diff --git a/test/command_callback/test_cpplint_command_callbacks.vader b/test/command_callback/test_cpplint_command_callbacks.vader index 34746a1b..d5fd457b 100644 --- a/test/command_callback/test_cpplint_command_callbacks.vader +++ b/test/command_callback/test_cpplint_command_callbacks.vader @@ -1,42 +1,17 @@ Before: - Save g:ale_cpp_cpplint_executable - Save g:ale_cpp_cpplint_options - - unlet! g:ale_cpp_cpplint_executable - unlet! b:ale_cpp_cpplint_executable - unlet! g:ale_cpp_cpplint_options - unlet! b:ale_cpp_cpplint_options - - runtime ale_linters/cpp/cpplint.vim + call ale#assert#SetUpLinterTest('cpp', 'cpplint') After: - Restore - unlet! b:command_tail - unlet! b:ale_cpp_cpplint_executable - unlet! b:ale_cpp_cpplint_options - call ale#linter#Reset() + call ale#assert#TearDownLinterTest() Execute(The executable should be configurable): - AssertEqual 'cpplint', ale_linters#cpp#cpplint#GetExecutable(bufnr('')) + AssertLinter 'cpplint', ale#Escape('cpplint') . ' %s' let b:ale_cpp_cpplint_executable = 'foobar' - AssertEqual 'foobar', ale_linters#cpp#cpplint#GetExecutable(bufnr('')) - -Execute(The executable should be used in the command): - AssertEqual - \ ale#Escape('cpplint') . ' %s', - \ ale_linters#cpp#cpplint#GetCommand(bufnr('')) - - let b:ale_cpp_cpplint_executable = 'foobar' + AssertLinter 'foobar', ale#Escape('foobar') . ' %s' - AssertEqual - \ ale#Escape('foobar') . ' %s', - \ ale_linters#cpp#cpplint#GetCommand(bufnr('')) - \ Execute(The options should be configurable): let b:ale_cpp_cpplint_options = '--something' - AssertEqual - \ ale#Escape('cpplint') . ' --something %s', - \ ale_linters#cpp#cpplint#GetCommand(bufnr('')) + AssertLinter 'cpplint', ale#Escape('cpplint') . ' --something %s' -- cgit v1.2.3