2017-07-06 23:10:30 +00:00
|
|
|
Before:
|
|
|
|
Save b:ale_go_gometalinter_executable
|
|
|
|
Save b:ale_go_gometalinter_options
|
|
|
|
|
|
|
|
let b:ale_go_gometalinter_executable = 'gometalinter'
|
|
|
|
let b:ale_go_gometalinter_options = ''
|
|
|
|
|
|
|
|
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
|
|
|
|
\ ale#Escape('gometalinter')
|
2017-07-11 22:47:13 +00:00
|
|
|
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%')))
|
2017-07-06 23:10:30 +00:00
|
|
|
\ . ' ' . ale#Escape(getcwd()),
|
|
|
|
\ 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
|
|
|
|
\ ale#Escape('something else')
|
2017-07-11 22:47:13 +00:00
|
|
|
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%')))
|
2017-07-06 23:10:30 +00:00
|
|
|
\ . ' ' . ale#Escape(getcwd()),
|
|
|
|
\ ale_linters#go#gometalinter#GetCommand(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The gometalinter callback should use configured options):
|
|
|
|
let b:ale_go_gometalinter_options = '--foobar'
|
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ ale#Escape('gometalinter')
|
2017-07-11 22:47:13 +00:00
|
|
|
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%')))
|
2017-07-06 23:10:30 +00:00
|
|
|
\ . ' --foobar'
|
|
|
|
\ . ' ' . ale#Escape(getcwd()),
|
|
|
|
\ ale_linters#go#gometalinter#GetCommand(bufnr(''))
|