summaryrefslogtreecommitdiff
path: root/test/command_callback/test_staticcheck_command_callback.vader
diff options
context:
space:
mode:
authorw0rp <devw0rp@gmail.com>2018-07-15 18:24:53 +0100
committerw0rp <devw0rp@gmail.com>2018-07-15 18:28:28 +0100
commita42999a639b2916b769a85f37d037be314d9d61b (patch)
tree5ebfb4d357dc673efa93fd32a66b489c4510de40 /test/command_callback/test_staticcheck_command_callback.vader
parent5155a35a80fe3b20659eb0f28cc6cc720532dd3f (diff)
downloadale-a42999a639b2916b769a85f37d037be314d9d61b.zip
Massively reduce the amount of code needed for linter tests
Diffstat (limited to 'test/command_callback/test_staticcheck_command_callback.vader')
-rw-r--r--test/command_callback/test_staticcheck_command_callback.vader31
1 files changed, 8 insertions, 23 deletions
diff --git a/test/command_callback/test_staticcheck_command_callback.vader b/test/command_callback/test_staticcheck_command_callback.vader
index e9628eb6..918c12a0 100644
--- a/test/command_callback/test_staticcheck_command_callback.vader
+++ b/test/command_callback/test_staticcheck_command_callback.vader
@@ -1,41 +1,26 @@
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#assert#SetUpLinterTest('go', 'staticcheck')
call ale#test#SetFilename('test.go')
After:
- Restore
-
- call ale#test#RestoreDirectory()
- call ale#linter#Reset()
+ call ale#assert#TearDownLinterTest()
Execute(The staticcheck callback should return the right defaults):
- AssertEqual
+ AssertLinter 'staticcheck',
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . 'staticcheck '
- \ . ale#Escape(expand('%' . ':t')),
- \ ale_linters#go#staticcheck#GetCommand(bufnr(''))
+ \ . ale#Escape(expand('%' . ':t'))
Execute(The staticcheck callback should use configured options):
let b:ale_go_staticcheck_options = '-test'
- AssertEqual
+ AssertLinter 'staticcheck',
\ 'cd ' . ale#Escape(expand('%:p:h')) . ' && '
\ . 'staticcheck '
- \ . '-test ' . ale#Escape(expand('%' . ':t')),
- \ ale_linters#go#staticcheck#GetCommand(bufnr(''))
+ \ . '-test ' . ale#Escape(expand('%' . ':t'))
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(''))
+ AssertLinter 'staticcheck',
+ \ 'cd ' . ale#Escape(expand('%:p:h')) . ' && staticcheck .',