2018-02-15 11:23:36 +00:00
|
|
|
Before:
|
2018-07-15 17:24:53 +00:00
|
|
|
call ale#assert#SetUpLinterTest('go', 'staticcheck')
|
2018-02-15 11:23:36 +00:00
|
|
|
call ale#test#SetFilename('test.go')
|
|
|
|
|
|
|
|
After:
|
2018-07-15 17:24:53 +00:00
|
|
|
call ale#assert#TearDownLinterTest()
|
2018-02-15 11:23:36 +00:00
|
|
|
|
|
|
|
Execute(The staticcheck callback should return the right defaults):
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'staticcheck',
|
2018-10-23 14:20:27 +00:00
|
|
|
\ ale#path#CdString(expand('%:p:h'))
|
2018-02-15 11:23:36 +00:00
|
|
|
\ . 'staticcheck '
|
2018-07-15 17:24:53 +00:00
|
|
|
\ . ale#Escape(expand('%' . ':t'))
|
2018-02-15 11:23:36 +00:00
|
|
|
|
|
|
|
Execute(The staticcheck callback should use configured options):
|
|
|
|
let b:ale_go_staticcheck_options = '-test'
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'staticcheck',
|
2018-10-23 14:20:27 +00:00
|
|
|
\ ale#path#CdString(expand('%:p:h'))
|
2018-02-15 11:23:36 +00:00
|
|
|
\ . 'staticcheck '
|
2018-07-15 17:24:53 +00:00
|
|
|
\ . '-test ' . ale#Escape(expand('%' . ':t'))
|
2018-02-15 11:23:36 +00:00
|
|
|
|
|
|
|
Execute(The staticcheck `lint_package` option should use the correct command):
|
|
|
|
let b:ale_go_staticcheck_lint_package = 1
|
|
|
|
|
2018-07-15 17:24:53 +00:00
|
|
|
AssertLinter 'staticcheck',
|
2018-10-23 14:20:27 +00:00
|
|
|
\ ale#path#CdString(expand('%:p:h')) . 'staticcheck .',
|
2019-04-11 02:25:06 +00:00
|
|
|
|
|
|
|
Execute(The staticcheck callback should use the `GO111MODULE` option if set):
|
|
|
|
let b:ale_go_go111module = 'off'
|
|
|
|
|
|
|
|
AssertLinter 'staticcheck',
|
|
|
|
\ ale#path#CdString(expand('%:p:h'))
|
|
|
|
\ . ale#Env('GO111MODULE', 'off')
|
|
|
|
\ . 'staticcheck '
|
|
|
|
\ . ale#Escape(expand('%' . ':t'))
|
|
|
|
|
|
|
|
" Test with lint_package option set
|
|
|
|
let b:ale_go_staticcheck_lint_package = 1
|
|
|
|
AssertLinter 'staticcheck',
|
|
|
|
\ ale#path#CdString(expand('%:p:h'))
|
|
|
|
\ . ale#Env('GO111MODULE', 'off')
|
|
|
|
\ . 'staticcheck .'
|
|
|
|
unlet! b:ale_go_go111module
|