2017-10-03 17:54:35 +00:00
|
|
|
Before:
|
|
|
|
Save g:ale_go_gofmt_executable
|
|
|
|
Save g:ale_go_gofmt_options
|
2019-08-02 08:09:10 +00:00
|
|
|
Save g:ale_go_go111module
|
2017-10-03 17:54:35 +00:00
|
|
|
|
|
|
|
" Use an invalid global executable, so we don't match it.
|
|
|
|
let g:ale_go_gofmt_executable = 'xxxinvalid'
|
|
|
|
let g:ale_go_gofmt_options = ''
|
|
|
|
|
|
|
|
call ale#test#SetDirectory('/testplugin/test/fixers')
|
|
|
|
|
|
|
|
After:
|
|
|
|
Restore
|
|
|
|
|
2019-08-02 08:09:10 +00:00
|
|
|
unlet! b:ale_go_go111module
|
|
|
|
|
2017-10-03 17:54:35 +00:00
|
|
|
call ale#test#RestoreDirectory()
|
|
|
|
|
|
|
|
Execute(The gofmt callback should return the correct default values):
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/go/testfile.go')
|
2017-10-03 17:54:35 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ {
|
2020-10-03 14:57:59 +00:00
|
|
|
\ 'command': ale#Escape('xxxinvalid'),
|
2017-10-03 17:54:35 +00:00
|
|
|
\ },
|
|
|
|
\ ale#fixers#gofmt#Fix(bufnr(''))
|
|
|
|
|
|
|
|
Execute(The gofmt callback should include custom gofmt options):
|
|
|
|
let g:ale_go_gofmt_options = "-r '(a) -> a'"
|
2019-08-02 08:09:10 +00:00
|
|
|
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/go/testfile.go')
|
2017-10-03 17:54:35 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ {
|
|
|
|
\ 'command': ale#Escape('xxxinvalid')
|
2020-10-03 14:57:59 +00:00
|
|
|
\ . ' ' . g:ale_go_gofmt_options,
|
2017-10-03 17:54:35 +00:00
|
|
|
\ },
|
|
|
|
\ ale#fixers#gofmt#Fix(bufnr(''))
|
2019-04-11 02:25:06 +00:00
|
|
|
|
|
|
|
Execute(The gofmt callback should support Go environment variables):
|
|
|
|
let g:ale_go_go111module = 'off'
|
2019-08-02 08:09:10 +00:00
|
|
|
|
2021-03-20 22:11:22 +00:00
|
|
|
call ale#test#SetFilename('../test-files/go/testfile.go')
|
2019-04-11 02:25:06 +00:00
|
|
|
|
|
|
|
AssertEqual
|
|
|
|
\ {
|
|
|
|
\ 'command': ale#Env('GO111MODULE', 'off')
|
2020-10-03 14:57:59 +00:00
|
|
|
\ . ale#Escape('xxxinvalid')
|
2019-04-11 02:25:06 +00:00
|
|
|
\ },
|
|
|
|
\ ale#fixers#gofmt#Fix(bufnr(''))
|