2017-07-06 23:10:30 +00:00
|
|
|
Before:
|
|
|
|
Save b:ale_go_gometalinter_executable
|
|
|
|
Save b:ale_go_gometalinter_options
|
2017-12-04 18:42:36 +00:00
|
|
|
Save b:ale_go_gometalinter_lint_package
|
2017-07-06 23:10:30 +00:00
|
|
|
|
|
|
|
let b:ale_go_gometalinter_executable = 'gometalinter'
|
|
|
|
let b:ale_go_gometalinter_options = ''
|
2017-12-04 18:42:36 +00:00
|
|
|
let b:ale_go_gometalinter_lint_package = 0
|
2017-07-06 23:10:30 +00:00
|
|
|
|
|
|
|
runtime ale_linters/go/gometalinter.vim
|
|
|
|
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
2017-07-06 23:10:30 +00:00
|
|
|
call ale#test#SetFilename('test.go')
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
2017-07-09 21:43:25 +00:00
|
|
|
call ale#test#RestoreDirectory()
|
2017-07-06 23:10:30 +00:00
|
|
|
call ale#linter#Reset()
|
|
|
|
|
|
|
|
Execute(The gometalinter callback should return the right defaults):
|
|
|
|
AssertEqual
|
|
|
|
\ 'gometalinter',
|
|
|
|
\ ale_linters#go#gometalinter#GetExecutable(bufnr(''))
|
|
|
|
AssertEqual
|
2017-12-04 18:42:36 +00:00
|
|
|
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
|
|
|
\ . ale#Escape('gometalinter')
|
|
|
|
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
|
|
|
\ . ' .',
|
2017-07-06 23:10:30 +00:00
|
|
|
\ ale_linters#go#gometalinter#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The gometalinter callback should use a configured executable):
|
|
|
|
let b:ale_go_gometalinter_executable = 'something else'
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'something else',
|
|
|
|
\ ale_linters#go#gometalinter#GetExecutable(bufnr(''))
|
|
|
|
AssertEqual
|
2017-12-04 18:42:36 +00:00
|
|
|
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
|
|
|
\ . ale#Escape('something else')
|
|
|
|
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
|
|
|
\ . ' .',
|
2017-07-06 23:10:30 +00:00
|
|
|
\ ale_linters#go#gometalinter#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The gometalinter callback should use configured options):
|
|
|
|
let b:ale_go_gometalinter_options = '--foobar'
|
|
|
|
|
|
|
|
AssertEqual
|
2017-12-04 18:42:36 +00:00
|
|
|
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
|
|
|
\ . ale#Escape('gometalinter')
|
|
|
|
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
|
|
|
|
\ . ' --foobar' . ' .',
|
|
|
|
\ ale_linters#go#gometalinter#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The gometalinter `lint_package` option should use the correct command):
|
|
|
|
let b:ale_go_gometalinter_lint_package = 1
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
|
|
|
\ . ale#Escape('gometalinter') . ' .',
|
2017-07-06 23:10:30 +00:00
|
|
|
\ ale_linters#go#gometalinter#GetCommand(bufnr(''))
|