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_elixir_mix_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_elixir_mix_command_callbacks.vader')
-rw-r--r-- | test/command_callback/test_elixir_mix_command_callbacks.vader | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/test/command_callback/test_elixir_mix_command_callbacks.vader b/test/command_callback/test_elixir_mix_command_callbacks.vader index 67785881..18fb13ed 100644 --- a/test/command_callback/test_elixir_mix_command_callbacks.vader +++ b/test/command_callback/test_elixir_mix_command_callbacks.vader @@ -1,37 +1,19 @@ Before: - runtime ale_linters/elixir/mix.vim - - call ale#test#SetDirectory('/testplugin/test/command_callback') - - let g:project_root = ale#path#Simplify(g:dir . '/mix_paths/wrapped_project') + call ale#assert#SetUpLinterTest('elixir', 'mix') let g:env_prefix = has('win32') - \ ? 'set MIX_BUILD_PATH=TEMP && ' - \ : 'MIX_BUILD_PATH=TEMP ' - - - function! GetCommand(buffer) abort - let l:command = ale_linters#elixir#mix#GetCommand(a:buffer) - - return substitute(l:command, 'MIX_BUILD_PATH=[^ ]\+', 'MIX_BUILD_PATH=TEMP', '') - endfunction + \ ? 'set MIX_BUILD_PATH=' . ale#Escape('TEMP_DIR') . ' && ' + \ : 'MIX_BUILD_PATH=' . ale#Escape('TEMP_DIR') . ' ' After: - Restore - unlet! g:env_prefix - unlet! g:project_root - - call ale#linter#Reset() - call ale#test#RestoreDirectory() - delfunction GetCommand + call ale#assert#TearDownLinterTest() Execute(The default mix command should be correct): call ale#test#SetFilename('mix_paths/wrapped_project/lib/app.ex') - AssertEqual - \ GetCommand(bufnr('')), - \ ale#path#CdString(g:project_root) + AssertLinter 'mix', + \ ale#path#CdString(ale#path#Simplify(g:dir . '/mix_paths/wrapped_project')) \ . g:env_prefix \ . 'mix compile %s' |