2018-06-06 23:58:32 -04:00
|
|
|
Before:
|
|
|
|
runtime ale_linters/elixir/mix.vim
|
|
|
|
|
|
|
|
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
|
|
|
|
2018-06-07 12:47:57 -04:00
|
|
|
let g:project_root = ale#path#Simplify(g:dir . '/mix_paths/wrapped_project')
|
|
|
|
|
2018-06-06 23:58:32 -04:00
|
|
|
let g:env_prefix = has('win32')
|
|
|
|
\ ? 'set MIX_BUILD_PATH=TEMP && '
|
|
|
|
\ : 'MIX_BUILD_PATH=TEMP '
|
|
|
|
|
|
|
|
|
2018-06-07 12:47:57 -04:00
|
|
|
function! GetCommand(buffer) abort
|
|
|
|
let l:command = ale_linters#elixir#mix#GetCommand(a:buffer)
|
2018-06-06 23:58:32 -04:00
|
|
|
|
|
|
|
let l:split_command = split(l:command, 'MIX_BUILD_PATH=[^ ]*\s')
|
|
|
|
|
|
|
|
return l:split_command[0] . 'MIX_BUILD_PATH=TEMP' . l:split_command[1]
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
unlet! g:env_prefix
|
2018-06-07 12:47:57 -04:00
|
|
|
unlet! g:project_root
|
2018-06-06 23:58:32 -04:00
|
|
|
|
|
|
|
call ale#linter#Reset()
|
|
|
|
call ale#test#RestoreDirectory()
|
|
|
|
|
|
|
|
delfunction GetCommand
|
|
|
|
|
|
|
|
Execute(The default mix command should be correct):
|
2018-06-07 12:47:57 -04:00
|
|
|
call ale#test#SetFilename('mix_paths/wrapped_project/lib/app.ex')
|
|
|
|
|
2018-06-06 23:58:32 -04:00
|
|
|
AssertEqual
|
2018-06-07 12:47:57 -04:00
|
|
|
\ GetCommand(bufnr('')),
|
|
|
|
\ ale#path#CdString(g:project_root)
|
2018-06-06 23:58:32 -04:00
|
|
|
\ . g:env_prefix
|
|
|
|
\ . 'mix compile %s'
|