mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 12:44:23 +08:00
@@ -1,9 +1,12 @@
|
||||
Before:
|
||||
Save g:ale_go_go_executable
|
||||
|
||||
call ale#assert#SetUpLinterTest('go', 'gobuild')
|
||||
|
||||
WithChainResults ['/foo/bar', '/foo/baz']
|
||||
|
||||
After:
|
||||
Restore
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default commands should be correct):
|
||||
@@ -17,3 +20,12 @@ Execute(Extra options should be supported):
|
||||
AssertLinter 'go',
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . 'go test --foo-bar -c -o /dev/null ./'
|
||||
|
||||
let g:ale_go_gobuild_options = ''
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_go_go_executable = 'foobar'
|
||||
|
||||
AssertLinter 'foobar',
|
||||
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
|
||||
\ . 'foobar test -c -o /dev/null ./'
|
||||
|
||||
@@ -1,12 +1,19 @@
|
||||
Before:
|
||||
Save g:ale_go_go_executable
|
||||
Save g:ale_go_govet_options
|
||||
call ale#assert#SetUpLinterTest('go', 'govet')
|
||||
|
||||
After:
|
||||
Restore
|
||||
call ale#assert#TearDownLinterTest()
|
||||
|
||||
Execute(The default command should be correct):
|
||||
AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet .'
|
||||
AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet .'
|
||||
|
||||
Execute(Extra options should be supported):
|
||||
let g:ale_go_govet_options = '--foo-bar'
|
||||
AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet . --foo-bar'
|
||||
AssertLinter 'go', 'cd ' . ale#Escape(expand('%:p:h')) . ' && go vet --foo-bar .'
|
||||
|
||||
Execute(The executable should be configurable):
|
||||
let g:ale_go_go_executable = 'foobar'
|
||||
AssertLinter 'foobar', 'cd ' . ale#Escape(expand('%:p:h')) . ' && foobar vet .'
|
||||
|
||||
24
test/fixers/test_gomod_fixer_callback.vader
Normal file
24
test/fixers/test_gomod_fixer_callback.vader
Normal file
@@ -0,0 +1,24 @@
|
||||
Before:
|
||||
Save g:ale_go_go_executable
|
||||
|
||||
" Use an invalid global executable, so we don't match it.
|
||||
let g:ale_go_go_executable = 'xxxinvalid'
|
||||
call ale#test#SetDirectory('/testplugin/test/fixers')
|
||||
|
||||
After:
|
||||
Restore
|
||||
|
||||
call ale#test#RestoreDirectory()
|
||||
|
||||
Execute(The gomod callback should return the correct default values):
|
||||
call ale#test#SetFilename('../go_files/go.mod')
|
||||
setl ft=gomod
|
||||
|
||||
AssertEqual
|
||||
\ {
|
||||
\ 'read_temporary_file': 1,
|
||||
\ 'command': ale#Escape('xxxinvalid')
|
||||
\ . ' mod edit -fmt'
|
||||
\ . ' %t',
|
||||
\ },
|
||||
\ ale#fixers#gomod#Fix(bufnr(''))
|
||||
1
test/go_files/go.mod
Normal file
1
test/go_files/go.mod
Normal file
@@ -0,0 +1 @@
|
||||
|
||||
Reference in New Issue
Block a user