1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
|
Before:
runtime ale_linters/powershell/powershell.vim
After:
call ale#linter#Reset()
Execute(The powershell handler should process syntax errors from parsing a powershell script):
AssertEqual
\ [
\ {
\ 'lnum': 8,
\ 'col': 29,
\ 'type': 'E',
\ 'text': 'Missing closing ''}'' in statement block or type definition.',
\ 'code': 'ParseException',
\ },
\ ],
\ ale_linters#powershell#powershell#Handle(bufnr(''), [
\ "At line:8 char:29",
\ "+ Invoke-Command -ScriptBlock {",
\ "+ ~",
\ "Missing closing '}' in statement block or type definition.",
\ "At /home/harrisj/tester.ps1:5 char:5",
\ "+ [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Contents);",
\ "+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~",
\ "+ CategoryInfo : NotSpecified: (:) [], ParseException",
\ "+ FullyQualifiedErrorId : ParseException"
\ ])
Execute(The powershell handler should process multiple syntax errors from parsing a powershell script):
AssertEqual
\ [
\ {
\ 'lnum': 11,
\ 'col': 31,
\ 'type': 'E',
\ 'text': 'The string is missing the terminator: ".',
\ 'code': 'ParseException'
\ },
\ {
\ 'lnum': 3,
\ 'col': 16,
\ 'type': 'E',
\ 'text': 'Missing closing ''}'' in statement block or type definition.',
\ 'code': 'ParseException'
\ },
\ ],
\ ale_linters#powershell#powershell#Handle(bufnr(''), [
\ 'At line:11 char:31',
\ '+ write-verbose ''deleted''',
\ '+ ~',
\ 'The string is missing the terminator: ".',
\ 'At line:3 char:16',
\ '+ invoke-command {',
\ '+ ~',
\ 'Missing closing ''}'' in statement block or type definition.',
\ 'At /var/folders/qv/15ybvt050v9cgwrm7c95x4r4zc4qsg/T/vwhzIc8/1/script.ps1:1 char:150',
\ '+ ... ontents); [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Con ...',
\ '+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~',
\ '+ CategoryInfo : NotSpecified: (:) [], ParseException',
\ '+ FullyQualifiedErrorId : ParseException'
\ ])
Execute(The powershell handler should process unexecpected token that contains a newline character):
AssertEqual
\ [
\ {
\ 'lnum': 2,
\ 'col': 8,
\ 'type': 'E',
\ 'text': 'The string is missing the terminator: ".',
\ 'code': 'ParseException'
\ },
\ {
\ 'lnum': 2,
\ 'col': 8,
\ 'type': 'E',
\ 'text': 'Unexpected token ''"',
\ 'code': 'ParseException'
\ },
\ {
\ 'lnum': 1,
\ 'col': 1,
\ 'type': 'E',
\ 'text': 'Missing closing ''}'' in statement block or type definition.',
\ 'code': 'ParseException'
\ }
\ ],
\ ale_linters#powershell#powershell#Handle(bufnr(''), [
\ 'At line:2 char:8',
\ '+ "" "',
\ '+ ~',
\ 'The string is missing the terminator: ".',
\ 'At line:2 char:8',
\ '+ "" "',
\ '+ ~',
\ 'Unexpected token ''"',
\ '',
\ ' }'' in expression or statement.',
\ '',
\ 'At line:1 char:1',
\ '+ {',
\ '+ ~',
\ 'Missing closing ''}'' in statement block or type definition.',
\ 'At C:\Users\jpharris\AppData\Local\Temp\VIAA777.tmp\script.ps1:1 char:150',
\ '+ ... ontents); [void]$ExecutionContext.InvokeCommand.NewScriptBlock($Con ...',
\ '+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~',
\ ' + CategoryInfo : NotSpecified: (:) [], ParseException',
\ ' + FullyQualifiedErrorId : ParseException'
\ ])
|