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_erlang_syntaxerl_command_callback.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_erlang_syntaxerl_command_callback.vader')
-rw-r--r-- | test/command_callback/test_erlang_syntaxerl_command_callback.vader | 95 |
1 files changed, 37 insertions, 58 deletions
diff --git a/test/command_callback/test_erlang_syntaxerl_command_callback.vader b/test/command_callback/test_erlang_syntaxerl_command_callback.vader index a9a1a500..28cff9b9 100644 --- a/test/command_callback/test_erlang_syntaxerl_command_callback.vader +++ b/test/command_callback/test_erlang_syntaxerl_command_callback.vader @@ -1,66 +1,45 @@ Before: - Save g:ale_erlang_syntaxerl_executable - - unlet! g:ale_erlang_syntaxerl_executable - unlet! b:ale_erlang_syntaxerl_executable - - runtime ale_linters/erlang/syntaxerl.vim + call ale#assert#SetUpLinterTest('erlang', 'syntaxerl') After: - Restore - - call ale#linter#Reset() - -Execute (The executable should be correct): - AssertEqual 'syntaxerl', ale_linters#erlang#syntaxerl#GetExecutable(bufnr('')) - - let g:ale_erlang_syntaxerl_executable = '/some/other/syntaxerl' - AssertEqual '/some/other/syntaxerl', ale_linters#erlang#syntaxerl#GetExecutable(bufnr('')) - - let b:ale_erlang_syntaxerl_executable = '/yet/another/syntaxerl' - AssertEqual '/yet/another/syntaxerl', ale_linters#erlang#syntaxerl#GetExecutable(bufnr('')) - + call ale#assert#TearDownLinterTest() -Execute (The executable should be presented in the feature check command): - let g:ale_erlang_syntaxerl_executable = '/some/other/syntaxerl' +Execute (The default commands should be correct): + AssertLinter 'syntaxerl', [ + \ ale#Escape('syntaxerl') . ' -h', + \ ale#Escape('syntaxerl') . ' %t', + \] - AssertEqual - \ ale#Escape('/some/other/syntaxerl') . ' -h', - \ ale_linters#erlang#syntaxerl#FeatureCheck(bufnr('')) +Execute (The executable should be configurable): + let b:ale_erlang_syntaxerl_executable = 'foobar' - let b:ale_erlang_syntaxerl_executable = '/yet/another/syntaxerl' - - AssertEqual - \ ale#Escape('/yet/another/syntaxerl') . ' -h', - \ ale_linters#erlang#syntaxerl#FeatureCheck(bufnr('')) - -Execute (The executable should be presented in the command): - let g:ale_erlang_syntaxerl_executable = '/some/other/syntaxerl' - - AssertEqual - \ ale#Escape('/some/other/syntaxerl') . ' %t', - \ ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), []) - - let b:ale_erlang_syntaxerl_executable = '/yet/another/syntaxerl' - - AssertEqual - \ ale#Escape('/yet/another/syntaxerl') . ' %t', - \ ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), []) + AssertLinter 'foobar', [ + \ ale#Escape('foobar') . ' -h', + \ ale#Escape('foobar') . ' %t', + \] Execute (The -b option should be used when available): - AssertEqual ale#Escape('syntaxerl') . ' %t', ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [ - \ 'Syntax checker for Erlang (0.14.0)', - \ 'Usage: syntaxerl [-d | --debug] <FILENAME>', - \ ' syntaxerl <-h | --help>', - \ ' -d, --debug Enable debug output', - \ ' -h, --help Show this message', - \ ]) - - AssertEqual ale#Escape('syntaxerl') . ' -b %s %t', ale_linters#erlang#syntaxerl#GetCommand(bufnr(''), [ - \ 'Syntax checker for Erlang (0.14.0)', - \ 'Usage: syntaxerl [-b | --base <FILENAME>] [-d | --debug] <FILENAME>', - \ ' syntaxerl <-h | --help>', - \ ' -b, --base Set original filename', - \ ' -d, --debug Enable debug output', - \ ' -h, --help Show this message', - \ ]) + WithChainResults [ + \ 'Syntax checker for Erlang (0.14.0)', + \ 'Usage: syntaxerl [-d | --debug] <FILENAME>', + \ ' syntaxerl <-h | --help>', + \ ' -d, --debug Enable debug output', + \ ' -h, --help Show this message', + \] + AssertLinter 'syntaxerl', [ + \ ale#Escape('syntaxerl') . ' -h', + \ ale#Escape('syntaxerl') . ' %t', + \] + + WithChainResults [ + \ 'Syntax checker for Erlang (0.14.0)', + \ 'Usage: syntaxerl [-b | --base <FILENAME>] [-d | --debug] <FILENAME>', + \ ' syntaxerl <-h | --help>', + \ ' -b, --base Set original filename', + \ ' -d, --debug Enable debug output', + \ ' -h, --help Show this message', + \] + AssertLinter 'syntaxerl', [ + \ ale#Escape('syntaxerl') . ' -h', + \ ale#Escape('syntaxerl') . ' -b %s %t', + \] |