]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/linter/test_shellcheck.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:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / linter / test_shellcheck.vader
1 Before:
2   call ale#assert#SetUpLinterTest('sh', 'shellcheck')
3   call ale#test#SetFilename('test.sh')
4
5   let b:suffix = ' -f gcc -'
6
7 After:
8   unlet! b:is_bash
9   unlet! b:suffix
10   call ale#assert#TearDownLinterTest()
11
12 Execute(The default shellcheck command should be correct):
13   AssertLinterCwd '%s:h'
14   AssertLinter 'shellcheck', ale#Escape('shellcheck') . b:suffix
15
16 Execute(The option disabling changing directories should work):
17   let g:ale_sh_shellcheck_change_directory = 0
18
19   AssertLinterCwd ''
20   AssertLinter 'shellcheck', ale#Escape('shellcheck') . b:suffix
21
22 Execute(The shellcheck command should accept options):
23   let b:ale_sh_shellcheck_options = '--foobar'
24
25   AssertLinter 'shellcheck', ale#Escape('shellcheck') . ' --foobar' . b:suffix
26
27 Execute(The shellcheck command should accept options and exclusions):
28   let b:ale_sh_shellcheck_options = '--foobar'
29   let b:ale_sh_shellcheck_exclusions = 'foo,bar'
30
31   AssertLinter 'shellcheck',
32   \ ale#Escape('shellcheck') . ' --foobar -e foo,bar' . b:suffix
33
34 Execute(The shellcheck command should include the dialect):
35   let b:is_bash = 1
36
37   AssertLinter 'shellcheck', ale#Escape('shellcheck') . ' -s bash' . b:suffix
38
39 Execute(The shellcheck command should use ale_sh_shellcheck_dialect):
40   let b:ale_sh_shellcheck_dialect = 'ksh93'
41
42   AssertLinter 'shellcheck', ale#Escape('shellcheck') . ' -s ksh93' . b:suffix
43
44 Execute(The shellcheck command should allow unspecified dialect):
45   let b:ale_sh_shellcheck_dialect = ''
46
47   AssertLinter 'shellcheck', ale#Escape('shellcheck') . b:suffix
48
49 Execute(The shellcheck command should include the dialect before options and exclusions):
50   let b:is_bash = 1
51   let b:ale_sh_shellcheck_options = '--foobar'
52   let b:ale_sh_shellcheck_exclusions = 'foo,bar'
53
54   AssertLinter 'shellcheck', ale#Escape('shellcheck')
55   \   . ' -s bash --foobar -e foo,bar'
56   \   . b:suffix
57
58 Execute(The -x option should be added when the version is new enough):
59   AssertLinter 'shellcheck', [
60   \ ale#Escape('shellcheck') . ' --version',
61   \ ale#Escape('shellcheck') . b:suffix,
62   \]
63
64   GivenCommandOutput [
65   \ 'ShellCheck - shell script analysis tool',
66   \ 'version: 0.4.4',
67   \ 'license: GNU General Public License, version 3',
68   \ 'website: http://www.shellcheck.net',
69   \]
70   AssertLinter 'shellcheck', [
71   \ ale#Escape('shellcheck') . ' --version',
72   \ ale#Escape('shellcheck') . ' -x' . b:suffix,
73   \]
74
75   " We should cache the version check
76   GivenCommandOutput []
77   AssertLinter 'shellcheck', [
78   \ ale#Escape('shellcheck') . ' -x' . b:suffix,
79   \]
80
81 Execute(The -x option should not be added when the version is too old):
82   GivenCommandOutput [
83   \ 'ShellCheck - shell script analysis tool',
84   \ 'version: 0.3.9',
85   \ 'license: GNU General Public License, version 3',
86   \ 'website: http://www.shellcheck.net',
87   \]
88   AssertLinter 'shellcheck', [
89   \ ale#Escape('shellcheck') . ' --version',
90   \ ale#Escape('shellcheck') . b:suffix,
91   \]
92
93 Execute(The version check shouldn't be run again for old versions):
94   GivenCommandOutput [
95   \ 'ShellCheck - shell script analysis tool',
96   \ 'version: 0.3.9',
97   \ 'license: GNU General Public License, version 3',
98   \ 'website: http://www.shellcheck.net',
99   \]
100   AssertLinter 'shellcheck', [
101   \ ale#Escape('shellcheck') . ' --version',
102   \ ale#Escape('shellcheck') . b:suffix,
103   \]
104   AssertLinter 'shellcheck', [
105   \ ale#Escape('shellcheck') . b:suffix,
106   \]