summaryrefslogtreecommitdiff
path: root/test/linter/test_bingo.vader
blob: 9e7190970fb9c9c7fe05704b2de23dd5296c608d (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
51
52
53
54
55
56
57
58
59
60
Before:
  Save g:ale_go_go111module

  call ale#assert#SetUpLinterTest('go', 'bingo')

After:
  Restore

  if isdirectory(g:dir . '/.git')
    call delete(g:dir . '/.git', 'd')
  endif

  unlet! b:ale_completion_enabled
  unlet! b:ale_go_go111module

  call ale#assert#TearDownLinterTest()

Execute(The default bingo executable and options should be correct):
  AssertLinter 'bingo', ale#Escape('bingo') . ' --mode stdio'

Execute(The bingo executable and options should be configurable):
  let b:ale_go_bingo_executable = 'boo'
  let b:ale_go_bingo_options = '--mode stdio --trace'

  AssertLinter 'boo', ale#Escape('boo') . ' --mode stdio --trace'

Execute(should support Go environment variables):
  call ale#test#SetFilename('../test-files/go/go1/prj1/file.go')
  let b:ale_go_go111module = 'on'

  AssertLinter 'bingo',
  \ ale#Env('GO111MODULE', 'on') . ale#Escape('bingo') . ' --mode stdio'

Execute(Should return directory for 'go.mod' if found in parent directory):
  call ale#test#SetFilename('../test-files/go/test.go')

  AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/go')

Execute(Should return nearest directory with '.git' if found in parent directory):
  call ale#test#SetFilename('test.go')
  call mkdir(g:dir . '/.git')

  AssertLSPProject g:dir

Execute(Should ignore 'go.mod' and return '.git' dir if modules off):
  call ale#test#SetFilename('../test-files/go/test.go')

  let b:ale_go_go111module = 'off'
  let b:parent_dir = ale#path#Simplify(g:dir . '/..')
  let b:git_dir = b:parent_dir . '/.git'

  if !isdirectory(b:git_dir)
    call mkdir(b:git_dir)
  endif

  AssertLSPProject b:parent_dir

  call delete(b:git_dir, 'd')
  unlet! b:parent_dir
  unlet! b:git_dir