ale/test/lsp/test_lsp_command_formatting...

45 lines
871 B
Plaintext
Raw Normal View History

2018-07-05 20:48:47 +00:00
Before:
Save g:ale_command_wrapper
2018-07-05 20:48:47 +00:00
runtime autoload/ale/lsp.vim
let g:ale_command_wrapper = ''
2018-07-05 20:48:47 +00:00
let g:args = []
" Mock the StartProgram function so we can just capture the arguments.
function! ale#lsp#StartProgram(...) abort
2018-08-24 12:16:58 +00:00
let g:args = a:000[1:]
2018-07-05 20:48:47 +00:00
endfunction
After:
Restore
2018-07-05 20:48:47 +00:00
unlet! g:args
runtime autoload/ale/lsp.vim
Execute(Command formatting should be applied correctly for LSP linters):
call ale#lsp_linter#StartLSP(
\ bufnr(''),
\ {
\ 'name': 'linter',
\ 'language': {-> 'x'},
\ 'project_root': {-> '/foo/bar'},
2018-07-05 20:48:47 +00:00
\ 'lsp': 'stdio',
\ 'executable': has('win32') ? 'cmd': 'true',
\ 'command': '%e --foo',
\ },
\ {-> 0}
2018-07-05 20:48:47 +00:00
\)
if has('win32')
AssertEqual
2018-08-24 12:16:58 +00:00
\ ['cmd', 'cmd /s/c "cmd --foo"'],
\ g:args
2018-07-05 20:48:47 +00:00
else
AssertEqual
2018-08-24 12:16:58 +00:00
\ ['true', [&shell, '-c', '''true'' --foo']],
\ g:args
2018-07-05 20:48:47 +00:00
endif