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