2019-01-05 19:12:55 +00:00
|
|
|
Before:
|
2019-08-02 08:09:10 +00:00
|
|
|
Save g:ale_go_go111module
|
|
|
|
|
2019-01-05 19:12:55 +00:00
|
|
|
call ale#assert#SetUpLinterTest('go', 'bingo')
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
2019-01-12 13:14:25 +00:00
|
|
|
if isdirectory(g:dir . '/.git')
|
|
|
|
call delete(g:dir . '/.git', 'd')
|
|
|
|
endif
|
|
|
|
|
2019-01-05 19:12:55 +00:00
|
|
|
unlet! b:ale_completion_enabled
|
2019-04-11 02:25:06 +00:00
|
|
|
unlet! b:ale_go_go111module
|
2019-01-05 19:12:55 +00:00
|
|
|
|
|
|
|
call ale#assert#TearDownLinterTest()
|
|
|
|
|
|
|
|
Execute(should set correct defaults):
|
|
|
|
AssertLinter 'bingo', ale#Escape('bingo') . ' --mode stdio'
|
|
|
|
|
|
|
|
Execute(should configure bingo callback executable):
|
|
|
|
let b:ale_go_bingo_executable = 'boo'
|
|
|
|
let b:ale_go_bingo_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'boo', ale#Escape('boo')
|
|
|
|
|
|
|
|
Execute(should set bingo options):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/go/go1/prj1/file.go')
|
2019-01-05 19:12:55 +00:00
|
|
|
" let b:ale_completion_enabled = 1
|
|
|
|
let b:ale_go_bingo_options = ''
|
|
|
|
|
|
|
|
AssertLinter 'bingo',
|
|
|
|
\ ale#Escape('bingo') . ''
|
|
|
|
|
|
|
|
let b:ale_go_bingo_options = '--mode stdio --trace'
|
|
|
|
|
|
|
|
AssertLinter 'bingo',
|
|
|
|
\ ale#Escape('bingo') . ' --mode stdio --trace'
|
2019-01-12 13:14:25 +00:00
|
|
|
|
2019-04-11 02:25:06 +00:00
|
|
|
Execute(should support Go environment variables):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/go/go1/prj1/file.go')
|
2019-04-11 02:25:06 +00:00
|
|
|
let b:ale_go_go111module = 'on'
|
|
|
|
|
|
|
|
AssertLinter 'bingo',
|
|
|
|
\ ale#Env('GO111MODULE', 'on') . ale#Escape('bingo') . ' --mode stdio'
|
|
|
|
|
|
|
|
|
2019-01-12 13:14:25 +00:00
|
|
|
Execute(Should return directory for 'go.mod' if found in parent directory):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/go/test.go')
|
2019-01-12 13:14:25 +00:00
|
|
|
|
2021-03-20 22:11:22 +00:00
|
|
|
AssertLSPProject ale#path#Simplify(g:dir . '/../test-files/go')
|
2019-01-12 13:14:25 +00:00
|
|
|
|
|
|
|
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
|
2019-04-11 02:25:06 +00:00
|
|
|
|
|
|
|
Execute(Should ignore 'go.mod' and return '.git' dir if modules off):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/go/test.go')
|
2019-04-11 02:25:06 +00:00
|
|
|
|
|
|
|
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
|