/ test / handler / test_psscriptanalyzer_handler.vader
test_psscriptanalyzer_handler.vader
 1  Before:
 2    runtime ale_linters/powershell/psscriptanalyzer.vim
 3  
 4  After:
 5    call ale#linter#Reset()
 6  
 7  Execute(The psscriptanalyzer handler should handle basic information or warnings):
 8    AssertEqual
 9    \ [
10    \   {
11    \     'lnum': 1,
12    \     'type': 'I',
13    \     'text': 'The cmdlet ''Get-GithubRepo'' does not have a help comment.',
14    \     'code': 'PSProvideCommentHelp',
15    \   },
16    \   {
17    \     'lnum': 9,
18    \     'type': 'W',
19    \     'text': '''%'' is an alias of ''ForEach-Object''. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.',
20    \     'code': 'PSAvoidUsingCmdletAliases',
21    \   },
22    \   {
23    \     'lnum': 23,
24    \     'type': 'E',
25    \     'text': 'The ComputerName parameter of a cmdlet should not be hardcoded as this will expose sensitive information about the system.',
26    \     'code': 'PSAvoidUsingComputerNameHardcoded',
27    \   },
28    \ ],
29    \ ale_linters#powershell#psscriptanalyzer#Handle(bufnr(''), [
30    \   '1',
31    \   'Information',
32    \   'The cmdlet ''Get-GithubRepo'' does not have a help comment.',
33    \   'PSProvideCommentHelp',
34    \   '9',
35    \   'Warning',
36    \   '''%'' is an alias of ''ForEach-Object''. Alias can introduce possible problems and make scripts hard to maintain. Please consider changing alias to its full content.',
37    \   'PSAvoidUsingCmdletAliases',
38    \   '23',
39    \   'Error',
40    \   'The ComputerName parameter of a cmdlet should not be hardcoded as this will expose sensitive information about the system.',
41    \   'PSAvoidUsingComputerNameHardcoded',
42    \ ])