2017-12-20 12:20:38 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_command_wrapper
|
|
|
|
|
|
|
|
let g:ale_command_wrapper = ''
|
|
|
|
|
|
|
|
function! TestCommand(expected_part, input) abort
|
|
|
|
let l:expected = has('win32')
|
2018-01-17 18:11:20 +00:00
|
|
|
\ ? 'cmd /s/c "' . a:expected_part . '"'
|
2017-12-20 12:20:38 +00:00
|
|
|
\ : split(&shell) + split(&shellcmdflag) + [a:expected_part]
|
|
|
|
|
|
|
|
AssertEqual l:expected, ale#job#PrepareCommand(bufnr(''), a:input)
|
|
|
|
endfunction
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
|
|
|
unlet! b:ale_command_wrapper
|
|
|
|
|
|
|
|
delfunction TestCommand
|
|
|
|
|
|
|
|
Execute(The command wrapper should work with a nice command):
|
|
|
|
let b:ale_command_wrapper = 'nice -n 5'
|
|
|
|
|
|
|
|
call TestCommand('nice -n 5 foo bar', 'foo bar')
|
|
|
|
|
2023-09-08 00:00:35 +00:00
|
|
|
Execute(The command wrapper should spread arguments correctly):
|
2017-12-20 12:20:38 +00:00
|
|
|
let b:ale_command_wrapper = 'wrap %* --'
|
|
|
|
|
|
|
|
call TestCommand('wrap foo bar --', 'foo bar')
|
|
|
|
|
|
|
|
Execute(Wrappers with the command as one argument should be supported):
|
|
|
|
let b:ale_command_wrapper = 'wrap -c %@ -x'
|
|
|
|
|
|
|
|
call TestCommand('wrap -c ' . ale#Escape('foo bar') . ' -x', 'foo bar')
|
|
|
|
|
|
|
|
Execute(&& and ; should be moved to the front):
|
|
|
|
let b:ale_command_wrapper = 'wrap -c %@ -x'
|
|
|
|
|
|
|
|
call TestCommand('foo && bar; wrap -c ' . ale#Escape('baz') . ' -x', 'foo && bar;baz')
|
|
|
|
|
|
|
|
let b:ale_command_wrapper = 'nice -n 5'
|
|
|
|
|
|
|
|
call TestCommand('foo && bar; nice -n 5 baz -z', 'foo && bar;baz -z')
|