Clean up the mix format command and tests

This commit is contained in:
w0rp 2018-03-18 17:40:34 +00:00
parent 92612a9eab
commit 440502dc93
No known key found for this signature in database
GPG key ID: 0FC1ECAA8C81CD83
2 changed files with 9 additions and 3 deletions

View file

@ -12,7 +12,9 @@ function! ale#fixers#mix_format#GetCommand(buffer) abort
let l:executable = ale#Escape(ale#fixers#mix_format#GetExecutable(a:buffer)) let l:executable = ale#Escape(ale#fixers#mix_format#GetExecutable(a:buffer))
let l:options = ale#Var(a:buffer, 'elixir_mix_format_options') let l:options = ale#Var(a:buffer, 'elixir_mix_format_options')
return l:executable . ' format ' . l:options . ' %t' return l:executable . ' format'
\ . (!empty(l:options) ? ' ' . l:options : '')
\ . ' %t'
endfunction endfunction
function! ale#fixers#mix_format#Fix(buffer) abort function! ale#fixers#mix_format#Fix(buffer) abort

View file

@ -1,11 +1,15 @@
Before: Before:
call ale#test#SetDirectory('/testplugin/test/fixers')
Save g:ale_elixir_mix_executable Save g:ale_elixir_mix_executable
Save g:ale_elixir_mix_format_options Save g:ale_elixir_mix_format_options
let g:ale_elixir_mix_executable = 'xxxinvalid' let g:ale_elixir_mix_executable = 'xxxinvalid'
let g:ale_elixir_mix_format_options = ''
call ale#test#SetDirectory('/testplugin/test/fixers')
After: After:
Restore
call ale#test#RestoreDirectory() call ale#test#RestoreDirectory()
Execute(The mix_format callback should return the correct default values): Execute(The mix_format callback should return the correct default values):
@ -15,7 +19,7 @@ Execute(The mix_format callback should return the correct default values):
\ { \ {
\ 'read_temporary_file': 1, \ 'read_temporary_file': 1,
\ 'command': ale#Escape('xxxinvalid') \ 'command': ale#Escape('xxxinvalid')
\ . ' format %t', \ . ' format %t',
\ }, \ },
\ ale#fixers#mix_format#Fix(bufnr('')) \ ale#fixers#mix_format#Fix(bufnr(''))