ale/test/lsp/test_lsp_command_formatting.vader

38 lines
803 B
Plaintext
Raw Normal View History

2018-07-05 16:48:47 -04:00
Before:
runtime autoload/ale/lsp.vim
let g:args = []
" Mock the StartProgram function so we can just capture the arguments.
function! ale#lsp#StartProgram(...) abort
2018-08-24 08:16:58 -04:00
let g:args = a:000[1:]
2018-07-05 16:48:47 -04:00
endfunction
After:
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',
2018-07-05 16:48:47 -04:00
\ 'language_callback': {-> 'x'},
\ 'project_root_callback': {-> '/foo/bar'},
\ 'lsp': 'stdio',
\ 'executable': has('win32') ? 'cmd': 'true',
\ 'command': '%e --foo',
\ },
\)
if has('win32')
AssertEqual
2018-08-24 08:16:58 -04:00
\ ['cmd', 'cmd /s/c "cmd --foo"'],
\ g:args
2018-07-05 16:48:47 -04:00
else
AssertEqual
2018-08-24 08:16:58 -04:00
\ ['true', [&shell, '-c', '''true'' --foo']],
\ g:args
2018-07-05 16:48:47 -04:00
endif