This repository has been archived on 2024-07-19. You can view files and clone it, but cannot push or open issues or pull requests.
ale/test/lsp/test_lsp_command_formatting.vader
2018-07-06 08:15:54 +01:00

37 lines
818 B
Text

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
let g:args = a:000
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(''),
\ {
\ 'language_callback': {-> 'x'},
\ 'project_root_callback': {-> '/foo/bar'},
\ 'lsp': 'stdio',
\ 'executable': has('win32') ? 'cmd': 'true',
\ 'command': '%e --foo',
\ },
\ {->0}
\)
if has('win32')
AssertEqual
\ ['true', 'cmd /s/c "cmd --foo"', '/foo/bar'],
\ g:args[:2]
else
AssertEqual
\ ['true', [&shell, '-c', '''true'' --foo'], '/foo/bar'],
\ g:args[:2]
endif