summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_bingo_command_callback.vader2
-rw-r--r--test/command_callback/test_gofmt_command_callback.vader8
-rw-r--r--test/command_callback/test_golangci_lint_command_callback.vader8
-rw-r--r--test/command_callback/test_golangserver_command_callback.vader1
-rw-r--r--test/command_callback/test_golint_command_callbacks.vader8
-rw-r--r--test/command_callback/test_gometalinter_command_callback.vader8
-rw-r--r--test/command_callback/test_gopls_command_callback.vader5
-rw-r--r--test/command_callback/test_gosimple_command_callback.vader6
-rw-r--r--test/command_callback/test_gotype_command_callback.vader6
-rw-r--r--test/command_callback/test_govet_command_callback.vader9
-rw-r--r--test/command_callback/test_staticcheck_command_callback.vader6
-rw-r--r--test/fixers/test_gofmt_fixer_callback.vader6
-rw-r--r--test/fixers/test_goimports_fixer_callback.vader4
-rw-r--r--test/fixers/test_gomod_fixer_callback.vader3
14 files changed, 63 insertions, 17 deletions
diff --git a/test/command_callback/test_bingo_command_callback.vader b/test/command_callback/test_bingo_command_callback.vader
index 3b5d2ac4..5544effa 100644
--- a/test/command_callback/test_bingo_command_callback.vader
+++ b/test/command_callback/test_bingo_command_callback.vader
@@ -1,4 +1,6 @@
Before:
+ Save g:ale_go_go111module
+
call ale#assert#SetUpLinterTest('go', 'bingo')
After:
diff --git a/test/command_callback/test_gofmt_command_callback.vader b/test/command_callback/test_gofmt_command_callback.vader
index 8223b099..4da1f6c8 100644
--- a/test/command_callback/test_gofmt_command_callback.vader
+++ b/test/command_callback/test_gofmt_command_callback.vader
@@ -1,8 +1,14 @@
Before:
+ Save g:ale_go_go111module
+
call ale#assert#SetUpLinterTest('go', 'gofmt')
call ale#test#SetFilename('../go_files/testfile2.go')
After:
+ Restore
+
+ unlet! b:ale_go_go111module
+
call ale#assert#TearDownLinterTest()
Execute(The default gofmt command should be correct):
@@ -15,5 +21,3 @@ Execute(The gofmt command should support Go environment variables):
AssertLinter 'gofmt',
\ ale#Env('GO111MODULE', 'on')
\ . ale#Escape('gofmt') . ' -e %t'
-
- unlet! b:ale_go_go111module
diff --git a/test/command_callback/test_golangci_lint_command_callback.vader b/test/command_callback/test_golangci_lint_command_callback.vader
index fed95126..7f1e2ac4 100644
--- a/test/command_callback/test_golangci_lint_command_callback.vader
+++ b/test/command_callback/test_golangci_lint_command_callback.vader
@@ -1,8 +1,14 @@
Before:
+ Save g:ale_go_go111module
+
call ale#assert#SetUpLinterTest('go', 'golangci_lint')
call ale#test#SetFilename('test.go')
After:
+ Restore
+
+ unlet! b:ale_go_go111module
+
call ale#assert#TearDownLinterTest()
Execute(The golangci-lint defaults should be correct):
@@ -40,8 +46,6 @@ Execute(The golangci-lint callback should support environment variables):
\ . ' run ' . ale#Escape(expand('%' . ':t'))
\ . ' --enable-all'
- unlet! b:ale_go_go111module
-
Execute(The golangci-lint `lint_package` option should use the correct command):
let b:ale_go_golangci_lint_package = 1
diff --git a/test/command_callback/test_golangserver_command_callback.vader b/test/command_callback/test_golangserver_command_callback.vader
index 47402965..325adf63 100644
--- a/test/command_callback/test_golangserver_command_callback.vader
+++ b/test/command_callback/test_golangserver_command_callback.vader
@@ -1,6 +1,7 @@
Before:
Save $GOPATH
Save g:ale_completion_enabled
+ Save g:ale_go_go111module
let g:ale_completion_enabled = 0
let g:sep = has('win32') ? ';' : ':'
diff --git a/test/command_callback/test_golint_command_callbacks.vader b/test/command_callback/test_golint_command_callbacks.vader
index 701d3ba3..64916707 100644
--- a/test/command_callback/test_golint_command_callbacks.vader
+++ b/test/command_callback/test_golint_command_callbacks.vader
@@ -1,7 +1,13 @@
Before:
+ Save g:ale_go_go111module
+
call ale#assert#SetUpLinterTest('go', 'golint')
After:
+ Restore
+
+ unlet! b:ale_go_go111module
+
call ale#assert#TearDownLinterTest()
Execute(The default golint command should be correct):
@@ -22,5 +28,3 @@ Execute(The golint command should support Go environment variables):
AssertLinter 'golint',
\ ale#Env('GO111MODULE', 'on') . ale#Escape('golint') . ' %t'
-
- unlet! b:ale_go_go111module
diff --git a/test/command_callback/test_gometalinter_command_callback.vader b/test/command_callback/test_gometalinter_command_callback.vader
index 308400b2..d922efc6 100644
--- a/test/command_callback/test_gometalinter_command_callback.vader
+++ b/test/command_callback/test_gometalinter_command_callback.vader
@@ -1,8 +1,14 @@
Before:
+ Save g:ale_go_go111module
+
call ale#assert#SetUpLinterTest('go', 'gometalinter')
call ale#test#SetFilename('test.go')
After:
+ Restore
+
+ unlet! b:ale_go_go111module
+
call ale#assert#TearDownLinterTest()
Execute(The gometalinter defaults should be correct):
@@ -32,13 +38,13 @@ Execute(The gometalinter callback should use configured options):
Execute(The gometalinter should use configured environment variables):
let b:ale_go_go111module = 'off'
+
AssertLinter 'gometalinter',
\ ale#path#CdString(expand('%:p:h'))
\ . ale#Env('GO111MODULE', 'off')
\ . ale#Escape('gometalinter')
\ . ' --include=' . ale#Escape(ale#util#EscapePCRE(expand('%' . ':t')))
\ . ' .'
- unlet! b:ale_go_go111module
Execute(The gometalinter `lint_package` option should use the correct command):
let b:ale_go_gometalinter_lint_package = 1
diff --git a/test/command_callback/test_gopls_command_callback.vader b/test/command_callback/test_gopls_command_callback.vader
index 4683efdd..92b20b18 100644
--- a/test/command_callback/test_gopls_command_callback.vader
+++ b/test/command_callback/test_gopls_command_callback.vader
@@ -1,14 +1,15 @@
Before:
+ Save g:ale_go_go111module
+
call ale#assert#SetUpLinterTest('go', 'gopls')
After:
- Restore
-
if isdirectory(g:dir . '/.git')
call delete(g:dir . '/.git', 'd')
endif
unlet! b:ale_go_go111module
+ unlet! b:ale_go_go111module
unlet! b:ale_completion_enabled
call ale#assert#TearDownLinterTest()
diff --git a/test/command_callback/test_gosimple_command_callback.vader b/test/command_callback/test_gosimple_command_callback.vader
index e6233091..ee89eed8 100644
--- a/test/command_callback/test_gosimple_command_callback.vader
+++ b/test/command_callback/test_gosimple_command_callback.vader
@@ -1,8 +1,12 @@
Before:
+ Save g:ale_go_go111module
+
call ale#assert#SetUpLinterTest('go', 'gosimple')
call ale#test#SetFilename('../go_files/testfile2.go')
After:
+ unlet! b:ale_go_go111module
+
call ale#assert#TearDownLinterTest()
Execute(The default gosimple command should be correct):
@@ -15,5 +19,3 @@ Execute(The gosimple command should support Go environment variables):
AssertLinter 'gosimple',
\ ale#path#CdString(expand('%:p:h')) . ' '
\ . ale#Env('GO111MODULE', 'on') . 'gosimple .'
-
- unlet! b:ale_go_go111module
diff --git a/test/command_callback/test_gotype_command_callback.vader b/test/command_callback/test_gotype_command_callback.vader
index c2661481..1334fcff 100644
--- a/test/command_callback/test_gotype_command_callback.vader
+++ b/test/command_callback/test_gotype_command_callback.vader
@@ -1,8 +1,12 @@
Before:
+ Save g:ale_go_go111module
+
call ale#assert#SetUpLinterTest('go', 'gotype')
call ale#test#SetFilename('../go_files/testfile2.go')
After:
+ unlet! b:ale_go_go111module
+
call ale#assert#TearDownLinterTest()
Execute(The default gotype command should be correct):
@@ -21,5 +25,3 @@ Execute(The gotype callback should support Go environment variables):
\ ale#path#CdString(expand('%:p:h')) . ' '
\ . ale#Env('GO111MODULE', 'on')
\ . 'gotype -e .'
-
- unlet! b:ale_go_go111module
diff --git a/test/command_callback/test_govet_command_callback.vader b/test/command_callback/test_govet_command_callback.vader
index 163fd8ea..59022180 100644
--- a/test/command_callback/test_govet_command_callback.vader
+++ b/test/command_callback/test_govet_command_callback.vader
@@ -1,10 +1,15 @@
Before:
Save g:ale_go_go_executable
Save g:ale_go_govet_options
+ Save g:ale_go_go111module
+
call ale#assert#SetUpLinterTest('go', 'govet')
After:
Restore
+
+ unlet! b:ale_go_go111module
+
call ale#assert#TearDownLinterTest()
Execute(The default command should be correct):
@@ -12,16 +17,18 @@ Execute(The default command should be correct):
Execute(Extra options should be supported):
let g:ale_go_govet_options = '--foo-bar'
+
AssertLinter 'go', ale#path#CdString(expand('%:p:h')) . ' go vet --foo-bar .'
Execute(The executable should be configurable):
let g:ale_go_go_executable = 'foobar'
+
AssertLinter 'foobar', ale#path#CdString(expand('%:p:h')) . ' foobar vet .'
Execute(Go environment variables should be supported):
let b:ale_go_go111module = 'on'
+
AssertLinter 'go',
\ ale#path#CdString(expand('%:p:h')) . ' '
\ . ale#Env('GO111MODULE', 'on')
\ . 'go vet .'
- unlet! b:ale_go_go111module
diff --git a/test/command_callback/test_staticcheck_command_callback.vader b/test/command_callback/test_staticcheck_command_callback.vader
index b9330b8d..ae0d3584 100644
--- a/test/command_callback/test_staticcheck_command_callback.vader
+++ b/test/command_callback/test_staticcheck_command_callback.vader
@@ -1,8 +1,12 @@
Before:
+ Save g:ale_go_go111module
+
call ale#assert#SetUpLinterTest('go', 'staticcheck')
call ale#test#SetFilename('test.go')
After:
+ unlet! b:ale_go_go111module
+
call ale#assert#TearDownLinterTest()
Execute(The staticcheck callback should return the right defaults):
@@ -36,8 +40,8 @@ Execute(The staticcheck callback should use the `GO111MODULE` option if set):
" Test with lint_package option set
let b:ale_go_staticcheck_lint_package = 1
+
AssertLinter 'staticcheck',
\ ale#path#CdString(expand('%:p:h'))
\ . ale#Env('GO111MODULE', 'off')
\ . 'staticcheck .'
- unlet! b:ale_go_go111module
diff --git a/test/fixers/test_gofmt_fixer_callback.vader b/test/fixers/test_gofmt_fixer_callback.vader
index b8376142..16659655 100644
--- a/test/fixers/test_gofmt_fixer_callback.vader
+++ b/test/fixers/test_gofmt_fixer_callback.vader
@@ -1,17 +1,19 @@
Before:
Save g:ale_go_gofmt_executable
Save g:ale_go_gofmt_options
+ Save g:ale_go_go111module
" 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')
After:
Restore
+ unlet! b:ale_go_go111module
+
call ale#test#RestoreDirectory()
Execute(The gofmt callback should return the correct default values):
@@ -28,6 +30,7 @@ Execute(The gofmt callback should return the correct default values):
Execute(The gofmt callback should include custom gofmt options):
let g:ale_go_gofmt_options = "-r '(a) -> a'"
+
call ale#test#SetFilename('../go_files/testfile.go')
AssertEqual
@@ -42,6 +45,7 @@ Execute(The gofmt callback should include custom gofmt options):
Execute(The gofmt callback should support Go environment variables):
let g:ale_go_go111module = 'off'
+
call ale#test#SetFilename('../go_files/testfile.go')
AssertEqual
diff --git a/test/fixers/test_goimports_fixer_callback.vader b/test/fixers/test_goimports_fixer_callback.vader
index a1b72425..3ea022ff 100644
--- a/test/fixers/test_goimports_fixer_callback.vader
+++ b/test/fixers/test_goimports_fixer_callback.vader
@@ -1,11 +1,11 @@
Before:
Save g:ale_go_goimports_executable
Save g:ale_go_goimports_options
+ Save g:ale_go_go111module
" 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')
@@ -13,6 +13,8 @@ Before:
After:
Restore
+ unlet! b:ale_go_go111module
+
call ale#test#RestoreDirectory()
Execute(The goimports callback should return 0 when the executable isn't executable):
diff --git a/test/fixers/test_gomod_fixer_callback.vader b/test/fixers/test_gomod_fixer_callback.vader
index 40658223..422caf63 100644
--- a/test/fixers/test_gomod_fixer_callback.vader
+++ b/test/fixers/test_gomod_fixer_callback.vader
@@ -1,5 +1,6 @@
Before:
Save g:ale_go_go_executable
+ Save g:ale_go_go111module
" Use an invalid global executable, so we don't match it.
let g:ale_go_go_executable = 'xxxinvalid'
@@ -9,6 +10,8 @@ Before:
After:
Restore
+ unlet! b:ale_go_go111module
+
call ale#test#RestoreDirectory()
Execute(The gomod callback should return the correct default values):