summaryrefslogtreecommitdiff
path: root/test/command_callback/test_staticcheck_command_callback.vader
diff options
context:
space:
mode:
authorSander van Harmelen <sander@xanzy.io>2018-02-15 12:23:36 +0100
committerSander van Harmelen <sander@xanzy.io>2018-02-20 16:11:35 +0100
commitab5257c3442f5d5b5236905a4c77f4f09a24d8b5 (patch)
tree0b9bd088252e6c15f4991d52d6a1155d4040ad19 /test/command_callback/test_staticcheck_command_callback.vader
parentfcb7932d7d61cda142da7597c9df4da4847f0ca8 (diff)
downloadale-ab5257c3442f5d5b5236905a4c77f4f09a24d8b5.zip
This fixes issue #936 by linting the whole package
Diffstat (limited to 'test/command_callback/test_staticcheck_command_callback.vader')
-rw-r--r--test/command_callback/test_staticcheck_command_callback.vader41
1 files changed, 41 insertions, 0 deletions
diff --git a/test/command_callback/test_staticcheck_command_callback.vader b/test/command_callback/test_staticcheck_command_callback.vader
new file mode 100644
index 00000000..e9628eb6
--- /dev/null
+++ b/test/command_callback/test_staticcheck_command_callback.vader
@@ -0,0 +1,41 @@
+Before:
+ Save b:ale_go_staticcheck_options
+ Save b:ale_go_staticcheck_lint_package
+
+ let b:ale_go_staticcheck_options = ''
+ let b:ale_go_staticcheck_lint_package = 0
+
+ runtime ale_linters/go/staticcheck.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 staticcheck callback should return the right defaults):
+ AssertEqual
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . 'staticcheck '
+ \ . ale#Escape(expand('%' . ':t')),
+ \ ale_linters#go#staticcheck#GetCommand(bufnr(''))
+
+Execute(The staticcheck callback should use configured options):
+ let b:ale_go_staticcheck_options = '-test'
+
+ AssertEqual
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . 'staticcheck '
+ \ . '-test ' . ale#Escape(expand('%' . ':t')),
+ \ ale_linters#go#staticcheck#GetCommand(bufnr(''))
+
+Execute(The staticcheck `lint_package` option should use the correct command):
+ let b:ale_go_staticcheck_lint_package = 1
+
+ AssertEqual
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
+ \ . 'staticcheck .',
+ \ ale_linters#go#staticcheck#GetCommand(bufnr(''))