]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/handler/test_shellcheck_handler.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 '56df844d3c39ec494dacc69eae34272b27db185a' as '.vim/bundle/asyncomplete'
[etc/vim.git] / .vim / bundle / ale / test / handler / test_shellcheck_handler.vader
1 Before:
2   runtime ale_linters/shell/shellcheck.vim
3
4 After:
5   call ale#linter#Reset()
6
7 Execute(The shellcheck handler should handle basic errors or warnings <0.7.0):
8   AssertEqual
9   \ [
10   \   {
11   \     'lnum': 2,
12   \     'col': 1,
13   \     'type': 'W',
14   \     'text': 'In POSIX sh, ''let'' is not supported.',
15   \     'code': 'SC2039',
16   \     'detail': 'In POSIX sh, ''let'' is not supported.' . "\n\nFor more information:\n  https://www.shellcheck.net/wiki/" . 'SC2039',
17   \   },
18   \   {
19   \     'lnum': 2,
20   \     'col': 3,
21   \     'type': 'E',
22   \     'text': 'Don''t put spaces around the = in assignments.',
23   \     'code': 'SC1068',
24   \     'detail': 'Don''t put spaces around the = in assignments.' . "\n\nFor more information:\n  https://www.shellcheck.net/wiki/" . 'SC1068',
25   \   },
26   \ ],
27   \ ale#handlers#shellcheck#Handle(bufnr(''), [0, 6, 0], [
28   \   '-:2:1: warning: In POSIX sh, ''let'' is not supported. [SC2039]',
29   \   '-:2:3: error: Don''t put spaces around the = in assignments. [SC1068]',
30   \ ])
31
32 Execute(The shellcheck handler should handle notes <0.7.0):
33   AssertEqual
34   \ [
35   \   {
36   \     'lnum': 3,
37   \     'col': 3,
38   \     'type': 'I',
39   \     'text': 'Double quote to prevent globbing and word splitting.',
40   \     'code': 'SC2086',
41   \     'detail': 'Double quote to prevent globbing and word splitting.' . "\n\nFor more information:\n  https://www.shellcheck.net/wiki/" . 'SC2086',
42   \   },
43   \ ],
44   \ ale#handlers#shellcheck#Handle(bufnr(''), [0, 6, 0], [
45   \   '-:3:3: note: Double quote to prevent globbing and word splitting. [SC2086]',
46   \ ])
47
48 Execute(The shellcheck handler should handle basic errors or warnings >=0.7.0):
49   AssertEqual
50   \ [
51   \   {
52   \     'lnum': 2,
53   \     'end_lnum': 3,
54   \     'col': 1,
55   \     'end_col': 1,
56   \     'type': 'W',
57   \     'text': 'In POSIX sh, ''let'' is not supported.',
58   \     'code': 'SC2039',
59   \     'detail': 'In POSIX sh, ''let'' is not supported.' . "\n\nFor more information:\n  https://www.shellcheck.net/wiki/" . 'SC2039',
60   \   },
61   \   {
62   \     'lnum': 2,
63   \     'end_lnum': 3,
64   \     'col': 3,
65   \     'end_col': 3,
66   \     'type': 'E',
67   \     'text': 'Don''t put spaces around the = in assignments.',
68   \     'code': 'SC1068',
69   \     'detail': 'Don''t put spaces around the = in assignments.' . "\n\nFor more information:\n  https://www.shellcheck.net/wiki/" . 'SC1068',
70   \   },
71   \ ],
72   \ ale#handlers#shellcheck#Handle(bufnr(''), [0, 7, 0], [
73   \   '{
74   \     "comments": [
75   \       {
76   \         "file":"-",
77   \         "line":2,
78   \         "endLine":3,
79   \         "column":1,
80   \         "endColumn":2,
81   \         "level":"warning",
82   \         "code":2039,
83   \         "message":"In POSIX sh, ''let'' is not supported.",
84   \         "fix": null
85   \       },
86   \       {
87   \         "file":"-",
88   \         "line":2,
89   \         "endLine":3,
90   \         "column":3,
91   \         "endColumn":4,
92   \         "level":"error",
93   \         "code":1068,
94   \         "message":"Don''t put spaces around the = in assignments.",
95   \         "fix": null
96   \       }
97   \     ]
98   \   }'
99   \ ])
100
101 Execute(The shellcheck handler should handle info and style >=0.7.0):
102   AssertEqual
103   \ [
104   \   {
105   \     'lnum': 3,
106   \     'end_lnum': 5,
107   \     'col': 3,
108   \     'end_col': 4,
109   \     'type': 'I',
110   \     'text': 'Double quote to prevent globbing and word splitting.',
111   \     'code': 'SC2086',
112   \     'detail': 'Double quote to prevent globbing and word splitting.' . "\n\nFor more information:\n  https://www.shellcheck.net/wiki/" . 'SC2086',
113   \   },
114   \   {
115   \     'lnum': 13,
116   \     'end_lnum': 13,
117   \     'col': 17,
118   \     'end_col': 27,
119   \     'type': 'I',
120   \     'text': '$/${} is unnecessary on arithmetic variables.',
121   \     'code': 'SC2004',
122   \     'detail': '$/${} is unnecessary on arithmetic variables.' . "\n\nFor more information:\n  https://www.shellcheck.net/wiki/" . 'SC2004',
123   \   }
124   \ ],
125   \ ale#handlers#shellcheck#Handle(bufnr(''), [0, 7, 0], [
126   \   '{
127   \     "comments": [
128   \       {
129   \         "file": "-",
130   \         "line": 3,
131   \         "endLine": 5,
132   \         "column": 3,
133   \         "endColumn": 5,
134   \         "level": "info",
135   \         "code": 2086,
136   \         "message": "Double quote to prevent globbing and word splitting.",
137   \         "fix": null
138   \       },
139   \       {
140   \         "file": "-",
141   \         "line": 13,
142   \         "endLine": 13,
143   \         "column": 17,
144   \         "endColumn": 28,
145   \         "level": "style",
146   \         "code": 2004,
147   \         "message": "$/${} is unnecessary on arithmetic variables.",
148   \         "fix": null
149   \       }
150   \     ]
151   \   }'
152   \ ])