diff options
author | w0rp <w0rp@users.noreply.github.com> | 2018-06-20 22:47:56 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-06-20 22:47:56 +0100 |
commit | 11f303f8532863fb03e21e1b6f77b9ebcf7b0704 (patch) | |
tree | 469b21214fd5f530c72cd4b98d98dddf4eef93bb /test/command_callback | |
parent | 0e1528ec34dbd025712f46a6e556b430c45c8173 (diff) | |
parent | b8be25adb408bffc7af9f2f92c8c5cc7a6813601 (diff) | |
download | ale-11f303f8532863fb03e21e1b6f77b9ebcf7b0704.zip |
Merge pull request #1618 from colbydehart/master
[new linter] Add mix linter for elixir
Diffstat (limited to 'test/command_callback')
-rw-r--r-- | test/command_callback/mix_paths/wrapped_project/mix.exs | 1 | ||||
-rw-r--r-- | test/command_callback/test_elixir_mix_command_callbacks.vader | 37 |
2 files changed, 38 insertions, 0 deletions
diff --git a/test/command_callback/mix_paths/wrapped_project/mix.exs b/test/command_callback/mix_paths/wrapped_project/mix.exs new file mode 100644 index 00000000..d2d855e6 --- /dev/null +++ b/test/command_callback/mix_paths/wrapped_project/mix.exs @@ -0,0 +1 @@ +use Mix.Config diff --git a/test/command_callback/test_elixir_mix_command_callbacks.vader b/test/command_callback/test_elixir_mix_command_callbacks.vader new file mode 100644 index 00000000..67785881 --- /dev/null +++ b/test/command_callback/test_elixir_mix_command_callbacks.vader @@ -0,0 +1,37 @@ +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') + + 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 + +After: + Restore + + unlet! g:env_prefix + unlet! g:project_root + + call ale#linter#Reset() + call ale#test#RestoreDirectory() + + delfunction GetCommand + +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) + \ . g:env_prefix + \ . 'mix compile %s' |