summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorTravis Gibson <TGib.Travis@protonmail.com>2018-10-03 14:13:34 -0700
committerTravis Gibson <TGib.Travis@protonmail.com>2018-10-03 14:13:34 -0700
commitadad9a21ab3fa16b115c044de3c46d98b577f72b (patch)
treed64b64b4cb765dec5ecc225c2b998425ad9108dc /test
parent2b2e766dc6df4d05e58c106f51b5444be4efbcea (diff)
downloadale-adad9a21ab3fa16b115c044de3c46d98b577f72b.zip
Fix crashes with incomplete errors
Diffstat (limited to 'test')
-rw-r--r--test/handler/test_perl6_handler.vader75
1 files changed, 75 insertions, 0 deletions
diff --git a/test/handler/test_perl6_handler.vader b/test/handler/test_perl6_handler.vader
index fbc5b12b..452a9174 100644
--- a/test/handler/test_perl6_handler.vader
+++ b/test/handler/test_perl6_handler.vader
@@ -200,3 +200,78 @@ Execute(The Perl6 linter should gracefully handle non-JSON messages):
\ ' ------> /win<HERE> 3/',
\ 'Syntax OK'
\ ])
+
+Execute(The Perl6 linter should gracefully handle messages without a line number):
+ call ale#test#SetFilename('bar.pl6')
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': '1',
+ \ 'end_lnum': '',
+ \ 'text': 'Cannot find method ''has_compile_time_value'' on object of type NQPMu',
+ \ 'type': 'E',
+ \ 'col' : '',
+ \ 'code': 'X::AdHoc',
+ \ }
+ \ ],
+ \ ale_linters#perl6#perl6#Handle(bufnr(''), [
+ \ '{',
+ \ '"X::AdHoc" : {',
+ \ '"message" : "Cannot find method ''has_compile_time_value'' on object of type NQPMu",',
+ \ '"payload" : "Cannot find method ''has_compile_time_value'' on object of type NQPMu"',
+ \ '}',
+ \ '}',
+ \ ])
+
+Execute(The Perl6 linter should not include errors from a known separate file):
+ call ale#test#SetFilename('bar.pl6')
+
+ AssertEqual
+ \ [],
+ \ ale_linters#perl6#perl6#Handle(bufnr(''), [
+ \ '{
+ \ "X::Undeclared" : {
+ \ "highexpect" : [ ],
+ \ "is-compile-time" : 1,
+ \ "modules" : [ ],
+ \ "column" : null,
+ \ "pos" : 18,
+ \ "symbol" : "$tes",
+ \ "filename" : "foo.pl6",
+ \ "what" : "Variable",
+ \ "pre" : "my $test = 0; say ",
+ \ "post" : "$tes",
+ \ "suggestions" : [
+ \ "$res",
+ \ "$test"
+ \ ],
+ \ "line" : 6,
+ \ "message" : "Variable ''$tes'' is not declared. Did you mean any of these?\n $res\n $test\n"
+ \ }
+ \ }'
+ \ ])
+
+Execute(The Perl6 linter should not ignore errors without a filename):
+ call ale#test#SetFilename('bar.pl6')
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': '3',
+ \ 'end_lnum': '',
+ \ 'text': 'Cannot find method ''has_compile_time_value'' on object of type NQPMu',
+ \ 'type': 'E',
+ \ 'col' : '',
+ \ 'code': 'X::AdHoc',
+ \ }
+ \ ],
+ \ ale_linters#perl6#perl6#Handle(bufnr(''), [
+ \ '{',
+ \ '"X::AdHoc" : {',
+ \ '"line" : 3,',
+ \ '"message" : "Cannot find method ''has_compile_time_value'' on object of type NQPMu",',
+ \ '"payload" : "Cannot find method ''has_compile_time_value'' on object of type NQPMu"',
+ \ '}',
+ \ '}',
+ \ ])