summaryrefslogtreecommitdiff
path: root/test/command_callback/test_golangserver_command_callback.vader
blob: a5893cee3c2896234e3edeeb1112d19145346e37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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')

After:
  Restore
  call ale#assert#TearDownLinterTest()

Execute(should set correct defaults):
  AssertLinter 'go-langserver', ale#Escape('go-langserver')

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'

  let b:ale_go_langserver_options = '-trace'
  AssertEqual ale_linters#go#golangserver#GetCommand(bufnr('%')), 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'

  let b:ale_completion_enabled = 0
  AssertEqual ale_linters#go#golangserver#GetCommand(bufnr('%')), 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')