/ test / handler / test_puppet_handler.vader
test_puppet_handler.vader
 1  Before:
 2    runtime ale_linters/puppet/puppet.vim
 3  
 4  After:
 5    call ale#linter#Reset()
 6  
 7  Execute(The puppet handler should parse lines correctly when no column is supplied):
 8    " Line Error
 9    AssertEqual
10    \ [
11    \   {
12    \     'lnum': 5,
13    \     'col': 0,
14    \     'text': "Syntax error at '='; expected '}'"
15    \   },
16    \   {
17    \     'lnum': 3,
18    \     'col': 0,
19    \     'text': "Syntax error at '='; expected '}'"
20    \   },
21    \ ],
22    \ ale_linters#puppet#puppet#Handle(255, [
23    \   "Error: Could not parse for environment production: Syntax error at '='; expected '}' at /root/puppetcode/modules/pancakes/manifests/init.pp:5",
24    \   "Error: Could not parse for environment production: Syntax error at '='; expected '}' at C:/puppet/modules/pancakes/manifests/init.pp:3",
25    \ ])
26  
27  Execute(The puppet handler should parse lines and column correctly):
28    " Line Error
29    AssertEqual
30    \ [
31    \   {
32    \     'lnum': 43,
33    \     'col': 12,
34    \     'text': "Syntax error at ':'"
35    \   },
36    \   {
37    \     'lnum': 54,
38    \     'col': 9,
39    \     'text': "Syntax error at ':'"
40    \   },
41    \   {
42    \     'lnum': 45,
43    \     'col': 12,
44    \     'text': "Syntax error at 'parameter1'"
45    \   },
46    \ ],
47    \ ale_linters#puppet#puppet#Handle(255, [
48    \   "Error: Could not parse for environment production: Syntax error at ':' at /root/puppetcode/modules/nginx/manifests/init.pp:43:12",
49    \   "Error: Could not parse for environment production: Syntax error at ':' at C:/puppet/modules/nginx/manifests/init.pp:54:9",
50    \   "Error: Could not parse for environment production: Syntax error at 'parameter1' (file: /tmp/modules/mariadb/manifests/slave.pp, line: 45, column: 12)",
51    \ ])
52  
53  Execute(The puppet handler should correctly parse errors that are reported before even trying to parse for an environment):
54    " Line Error
55    AssertEqual
56    \ [
57    \   {
58    \     'lnum': 5,
59    \     'col': 11,
60    \     'text': "Illegal attempt to assign to 'a Name'. Not an assignable reference"
61    \   },
62    \ ],
63    \ ale_linters#puppet#puppet#Handle(255, [
64    \   "Error: Illegal attempt to assign to 'a Name'. Not an assignable reference (file: /tmp/modules/waffles/manifests/syrup.pp, line: 5, column: 11)",
65    \ ])
66  Execute(The puppet handler should parse lines when end of input is the location):
67    AssertEqual
68    \ [
69    \   {
70    \     'lnum': 0,
71    \     'col': 0,
72    \     'text': "Syntax error at end of input"
73    \   },
74    \ ],
75    \ ale_linters#puppet#puppet#Handle(255, [
76    \   "Error: Could not parse for environment production: Syntax error at end of input (file: /tmp//modules/test/manifests/init.pp)",
77    \ ])