You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
1.5 KiB
Plaintext
50 lines
1.5 KiB
Plaintext
7 years ago
|
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
|
||
|
|
||
|
call ale#test#SetDirectory('/testplugin/test/command_callback')
|
||
|
call ale#test#SetFilename('test.go')
|
||
|
|
||
|
After:
|
||
|
Restore
|
||
|
|
||
|
call ale#test#RestoreDirectory()
|
||
|
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')
|
||
|
\ . ' --include=' . ale#Escape('^' . ale#util#EscapePCRE(expand('%')))
|
||
|
\ . ' ' . 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')
|
||
|
\ . ' --include=' . ale#Escape('^' . ale#util#EscapePCRE(expand('%')))
|
||
|
\ . ' ' . 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')
|
||
|
\ . ' --include=' . ale#Escape('^' . ale#util#EscapePCRE(expand('%')))
|
||
|
\ . ' --foobar'
|
||
|
\ . ' ' . ale#Escape(getcwd()),
|
||
|
\ ale_linters#go#gometalinter#GetCommand(bufnr(''))
|