diff options
author | w0rp <devw0rp@gmail.com> | 2018-07-05 21:48:47 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-07-05 21:48:47 +0100 |
commit | d5b4f6f7e72747cdfaac9fb17c9d473ffe5b3249 (patch) | |
tree | 6ea7e390a3352ab2d1a53805a02d58861c113bd4 /test | |
parent | da692b2e2dd9bc81047449b8811ab2672004b8bc (diff) | |
download | ale-d5b4f6f7e72747cdfaac9fb17c9d473ffe5b3249.zip |
Fix command formatting for LSP linters
Diffstat (limited to 'test')
-rw-r--r-- | test/lsp/test_lsp_command_formatting.vader | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/test/lsp/test_lsp_command_formatting.vader b/test/lsp/test_lsp_command_formatting.vader new file mode 100644 index 00000000..35c79096 --- /dev/null +++ b/test/lsp/test_lsp_command_formatting.vader @@ -0,0 +1,37 @@ +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', ['/bin/bash', '-c', '''true'' --foo'], '/foo/bar'], + \ g:args[:2] + endif |