]> git.madduck.net Git - etc/vim.git/blob - test/linter/test_staticcheck.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Squashed '.vim/bundle/ale/' content from commit 22185c4c
[etc/vim.git] / test / linter / test_staticcheck.vader
1 Before:
2   Save g:ale_go_go111module
3   Save $GOPATH
4
5   let $GOPATH = '/non/existent/directory'
6
7   call ale#assert#SetUpLinterTest('go', 'staticcheck')
8   call ale#test#SetFilename('test.go')
9
10 After:
11   unlet! b:ale_go_go111module
12
13   call ale#assert#TearDownLinterTest()
14
15 Execute(The staticcheck callback should return the right defaults):
16   AssertLinterCwd '%s:h'
17   AssertLinter 'staticcheck', ale#Escape('staticcheck') . ' .'
18
19 Execute(staticcheck should be found in GOPATH):
20   " This is a directory with a fake executable
21   let $GOPATH = ale#test#GetFilename('../test-files/go/gopath')
22
23   AssertLinter
24   \ ale#test#GetFilename('../test-files/go/gopath/bin/staticcheck'),
25   \ ale#Escape(ale#test#GetFilename('../test-files/go/gopath/bin/staticcheck'))
26   \   . ' .'
27
28 Execute(The staticcheck callback should use configured options):
29   let b:ale_go_staticcheck_options = '-test'
30
31   AssertLinter 'staticcheck', ale#Escape('staticcheck') . ' -test .'
32
33 Execute(Unset the staticcheck `lint_package` option should use the correct command):
34   let b:ale_go_staticcheck_lint_package = 0
35
36   AssertLinterCwd '%s:h'
37   AssertLinter 'staticcheck', ale#Escape('staticcheck') . ' %s:t'
38
39 Execute(The staticcheck callback should use the `GO111MODULE` option if set):
40   let b:ale_go_go111module = 'off'
41
42   AssertLinter 'staticcheck',
43   \ ale#Env('GO111MODULE', 'off') . ale#Escape('staticcheck') . ' .'
44
45   " Test with lint_package option set
46   let b:ale_go_staticcheck_lint_package = 0
47
48   AssertLinter 'staticcheck',
49   \ ale#Env('GO111MODULE', 'off') . ale#Escape('staticcheck') . ' %s:t'