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_cpp_clangcheck_command_callbacks.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_cpp_clangcheck_command_callbacks.vader')
-rw-r--r-- | test/command_callback/test_cpp_clangcheck_command_callbacks.vader | 48 |
1 files changed, 10 insertions, 38 deletions
diff --git a/test/command_callback/test_cpp_clangcheck_command_callbacks.vader b/test/command_callback/test_cpp_clangcheck_command_callbacks.vader index f708c52d..7aa09eed 100644 --- a/test/command_callback/test_cpp_clangcheck_command_callbacks.vader +++ b/test/command_callback/test_cpp_clangcheck_command_callbacks.vader @@ -1,63 +1,35 @@ Before: - Save g:ale_cpp_clangcheck_executable - Save g:ale_cpp_clangcheck_options - - unlet! g:ale_cpp_clangcheck_executable - unlet! b:ale_cpp_clangcheck_executable - unlet! g:ale_cpp_clangcheck_options - unlet! b:ale_cpp_clangcheck_options - - runtime ale_linters/cpp/clangcheck.vim + call ale#assert#SetUpLinterTest('cpp', 'clangcheck') After: - Restore - unlet! b:command_tail - unlet! b:ale_cpp_clangcheck_executable - unlet! b:ale_cpp_clangcheck_options - unlet! b:ale_c_build_dir - call ale#linter#Reset() + call ale#assert#TearDownLinterTest() Execute(The executable should be configurable): - AssertEqual 'clang-check', ale_linters#cpp#clangcheck#GetExecutable(bufnr('')) - - let b:ale_cpp_clangcheck_executable = 'foobar' - - AssertEqual 'foobar', ale_linters#cpp#clangcheck#GetExecutable(bufnr('')) - -Execute(The executable should be used in the command): - AssertEqual + AssertLinter 'clang-check', \ ale#Escape('clang-check') - \ . ' -analyze %s' - \ . ' -extra-arg -Xclang -extra-arg -analyzer-output=text', - \ ale_linters#cpp#clangcheck#GetCommand(bufnr('')) + \ . ' -analyze %s -extra-arg -Xclang -extra-arg -analyzer-output=text' let b:ale_cpp_clangcheck_executable = 'foobar' " The extra arguments in the command are used to prevent .plist files from " being generated. - AssertEqual + AssertLinter 'foobar', \ ale#Escape('foobar') - \ . ' -analyze %s' - \ . ' -extra-arg -Xclang -extra-arg -analyzer-output=text', - \ ale_linters#cpp#clangcheck#GetCommand(bufnr('')) + \ . ' -analyze %s -extra-arg -Xclang -extra-arg -analyzer-output=text' Execute(The options should be configurable): let b:ale_cpp_clangcheck_options = '--something' - AssertEqual + AssertLinter 'clang-check', \ ale#Escape('clang-check') \ . ' -analyze %s' \ . ' -extra-arg -Xclang -extra-arg -analyzer-output=text' - \ . ' --something', - \ ale_linters#cpp#clangcheck#GetCommand(bufnr('')) + \ . ' --something' Execute(The build directory should be used when set): let b:ale_cpp_clangcheck_options = '--something' let b:ale_c_build_dir = '/foo/bar' - AssertEqual + AssertLinter 'clang-check', \ ale#Escape('clang-check') - \ . ' -analyze %s ' - \ . '--something -p ' - \ . ale#Escape('/foo/bar'), - \ ale_linters#cpp#clangcheck#GetCommand(bufnr('')) + \ . ' -analyze %s --something -p ' . ale#Escape('/foo/bar') |