diff options
Diffstat (limited to 'test/fixers')
-rw-r--r-- | test/fixers/test_gofmt_fixer_callback.vader | 14 | ||||
-rw-r--r-- | test/fixers/test_goimports_fixer_callback.vader | 14 | ||||
-rw-r--r-- | test/fixers/test_gomod_fixer_callback.vader | 16 |
3 files changed, 43 insertions, 1 deletions
diff --git a/test/fixers/test_gofmt_fixer_callback.vader b/test/fixers/test_gofmt_fixer_callback.vader index 14e6e063..b8376142 100644 --- a/test/fixers/test_gofmt_fixer_callback.vader +++ b/test/fixers/test_gofmt_fixer_callback.vader @@ -5,6 +5,7 @@ Before: " Use an invalid global executable, so we don't match it. let g:ale_go_gofmt_executable = 'xxxinvalid' let g:ale_go_gofmt_options = '' + let g:ale_go_go111module = '' call ale#test#SetDirectory('/testplugin/test/fixers') @@ -38,3 +39,16 @@ Execute(The gofmt callback should include custom gofmt options): \ . ' %t', \ }, \ ale#fixers#gofmt#Fix(bufnr('')) + +Execute(The gofmt callback should support Go environment variables): + let g:ale_go_go111module = 'off' + call ale#test#SetFilename('../go_files/testfile.go') + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Env('GO111MODULE', 'off') + \ . ale#Escape('xxxinvalid') . ' -l -w' + \ . ' %t', + \ }, + \ ale#fixers#gofmt#Fix(bufnr('')) diff --git a/test/fixers/test_goimports_fixer_callback.vader b/test/fixers/test_goimports_fixer_callback.vader index cec06354..a1b72425 100644 --- a/test/fixers/test_goimports_fixer_callback.vader +++ b/test/fixers/test_goimports_fixer_callback.vader @@ -5,6 +5,7 @@ Before: " Use an invalid global executable, so we don't match it. let g:ale_go_goimports_executable = 'xxxinvalid' let g:ale_go_goimports_options = '' + let g:ale_go_go111module = '' call ale#test#SetDirectory('/testplugin/test/fixers') call ale#test#SetFilename('../go_files/testfile.go') @@ -39,3 +40,16 @@ Execute(The goimports callback should include extra options): \ 'command': ale#Escape(g:ale_go_goimports_executable) . ' -l -w -srcdir %s --xxx %t' \ }, \ ale#fixers#goimports#Fix(bufnr('')) + +Execute(The goimports callback should support Go environment variables): + let g:ale_go_goimports_executable = has('win32') ? 'cmd' : 'echo' + let g:ale_go_go111module = 'on' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Env('GO111MODULE', 'on') + \ . ale#Escape(g:ale_go_goimports_executable) + \ . ' -l -w -srcdir %s %t' + \ }, + \ ale#fixers#goimports#Fix(bufnr('')) diff --git a/test/fixers/test_gomod_fixer_callback.vader b/test/fixers/test_gomod_fixer_callback.vader index a378e961..40658223 100644 --- a/test/fixers/test_gomod_fixer_callback.vader +++ b/test/fixers/test_gomod_fixer_callback.vader @@ -3,6 +3,7 @@ Before: " Use an invalid global executable, so we don't match it. let g:ale_go_go_executable = 'xxxinvalid' + let g:ale_go_go111module = '' call ale#test#SetDirectory('/testplugin/test/fixers') After: @@ -12,7 +13,7 @@ After: Execute(The gomod callback should return the correct default values): call ale#test#SetFilename('../go_files/go.mod') - setl ft=gomod + setl filetype=gomod AssertEqual \ { @@ -22,3 +23,16 @@ Execute(The gomod callback should return the correct default values): \ . ' %t', \ }, \ ale#fixers#gomod#Fix(bufnr('')) + +Execute(The gomod callback should support Go environment variables): + call ale#test#SetFilename('../go_files/go.mod') + setl filetype=gomod + let g:ale_go_go111module = 'on' + + AssertEqual + \ { + \ 'read_temporary_file': 1, + \ 'command': ale#Env('GO111MODULE', 'on') + \ . ale#Escape('xxxinvalid') . ' mod edit -fmt %t' + \ }, + \ ale#fixers#gomod#Fix(bufnr('')) |