diff options
author | w0rp <devw0rp@gmail.com> | 2018-09-06 17:05:05 +0100 |
---|---|---|
committer | w0rp <devw0rp@gmail.com> | 2018-09-06 17:05:05 +0100 |
commit | 70867692894aa99e9ef450f19f5ff7b571b98aad (patch) | |
tree | 813311c9a3573aec5fd1e8a4fdf92f3978845ca5 | |
parent | f1d5bcbf988d2fff1ce396537534e55611c8b8d6 (diff) | |
download | ale-70867692894aa99e9ef450f19f5ff7b571b98aad.zip |
#1891 Fix the go-langserver tests
-rw-r--r-- | ale_linters/go/langserver.vim (renamed from ale_linters/go/golangserver.vim) | 4 | ||||
-rw-r--r-- | test/command_callback/test_golangserver_command_callback.vader | 37 |
2 files changed, 29 insertions, 12 deletions
diff --git a/ale_linters/go/golangserver.vim b/ale_linters/go/langserver.vim index c80b096d..df956483 100644 --- a/ale_linters/go/golangserver.vim +++ b/ale_linters/go/langserver.vim @@ -4,7 +4,7 @@ call ale#Set('go_langserver_executable', 'go-langserver') call ale#Set('go_langserver_options', '') -function! ale_linters#go#golangserver#GetCommand(buffer) abort +function! ale_linters#go#langserver#GetCommand(buffer) abort let l:executable = [ale#Escape(ale#Var(a:buffer, 'go_langserver_executable'))] let l:options = ale#Var(a:buffer, 'go_langserver_options') let l:options = substitute(l:options, '-gocodecompletion', '', 'g') @@ -23,6 +23,6 @@ call ale#linter#Define('go', { \ 'name': 'golangserver', \ 'lsp': 'stdio', \ 'executable_callback': ale#VarFunc('go_langserver_executable'), -\ 'command_callback': 'ale_linters#go#golangserver#GetCommand', +\ 'command_callback': 'ale_linters#go#langserver#GetCommand', \ 'project_root_callback': 'ale#go#FindProjectRoot', \}) diff --git a/test/command_callback/test_golangserver_command_callback.vader b/test/command_callback/test_golangserver_command_callback.vader index a5893cee..ee88e1a4 100644 --- a/test/command_callback/test_golangserver_command_callback.vader +++ b/test/command_callback/test_golangserver_command_callback.vader @@ -1,13 +1,21 @@ Before: Save $GOPATH - call ale#assert#SetUpLinterTest('go', 'golangserver') - let sep = has('win32') ? ';' : ':' - let $GOPATH=ale#path#Simplify(g:dir . '/go_paths/go1') - \ . sep - \ . ale#path#Simplify(g:dir . '/go_paths/go2') + Save g:ale_completion_enabled + + let g:ale_completion_enabled = 0 + let g:sep = has('win32') ? ';' : ':' + + call ale#assert#SetUpLinterTest('go', 'langserver') + let $GOPATH = ale#path#Simplify(g:dir . '/go_paths/go1') + \ . g:sep + \ . ale#path#Simplify(g:dir . '/go_paths/go2') After: Restore + + unlet! b:ale_completion_enabled + unlet! g:sep + call ale#assert#TearDownLinterTest() Execute(should set correct defaults): @@ -15,36 +23,45 @@ Execute(should set correct defaults): Execute(should configure go-langserver callback executable): let b:ale_go_langserver_executable = 'boo' + AssertLinter 'boo', ale#Escape('boo') - unlet b:ale_go_langserver_executable Execute(should set go-langserver options): call ale#test#SetFilename('go_paths/go1/prj1/file.go') let b:ale_completion_enabled = 1 let b:ale_go_langserver_options = '' - AssertEqual ale_linters#go#golangserver#GetCommand(bufnr('%')), ale#Escape('go-langserver') . ' -gocodecompletion' + + AssertLinter 'go-langserver', + \ ale#Escape('go-langserver') . ' -gocodecompletion' let b:ale_go_langserver_options = '-trace' - AssertEqual ale_linters#go#golangserver#GetCommand(bufnr('%')), ale#Escape('go-langserver') . ' -gocodecompletion -trace' + + AssertLinter 'go-langserver', + \ ale#Escape('go-langserver') . ' -gocodecompletion -trace' Execute(should ignore go-langserver -gocodecompletion option): call ale#test#SetFilename('go_paths/go1/prj1/file.go') let b:ale_go_langserver_options = '-trace -gocodecompletion' let b:ale_completion_enabled = 1 - AssertEqual ale_linters#go#golangserver#GetCommand(bufnr('%')), ale#Escape('go-langserver') . ' -gocodecompletion -trace' + + AssertLinter 'go-langserver', + \ ale#Escape('go-langserver') . ' -gocodecompletion -trace' let b:ale_completion_enabled = 0 - AssertEqual ale_linters#go#golangserver#GetCommand(bufnr('%')), ale#Escape('go-langserver') . ' -trace' + + AssertLinter 'go-langserver', ale#Escape('go-langserver') . ' -trace' Execute(should set go-langserver for go app1): call ale#test#SetFilename('go_paths/go1/prj1/file.go') + AssertLSPLanguage 'go' AssertLSPOptions {} AssertLSPProject ale#path#Simplify(g:dir . '/go_paths/go1') Execute(should set go-langserver for go app2): call ale#test#SetFilename('go_paths/go2/prj1/file.go') + AssertLSPLanguage 'go' AssertLSPOptions {} AssertLSPProject ale#path#Simplify(g:dir . '/go_paths/go2') |