summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorDavid A. R. Robin <david.a.r.robin@gmail.com>2019-06-24 06:24:07 +0200
committerDavid A. R. Robin <david.a.r.robin@gmail.com>2019-10-11 18:34:09 +0200
commite19b8c05cd8b0e74eb71d577ce6239bc71717dd9 (patch)
tree07abbb6d9ca1daccc7782c5ba5411af0f2c17411 /test
parent65ba4b85ec3011cccb9ea7135183e7fc8d7a0d69 (diff)
downloadale-e19b8c05cd8b0e74eb71d577ce6239bc71717dd9.zip
Fix crystal-lang non file-tied message handling
Some messages of the crystal compiler are not tied to a file. This causes a 'Key not present in Dictionnary' error (E716). For the record, the json output on ```require "./nonexistent.cr"``` is the following : ```json [ { "file":"/tmp/file.cr", "line":1, "column":1, "size":0, "message":"while requiring \"./nonexistent.cr\"" }, { "message":"can't find file './nonexistent.cr' relative to '/tmp'" } ] ``` The second message does not have line/column attributes.
Diffstat (limited to 'test')
-rw-r--r--test/handler/test_crystal_handler.vader10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/handler/test_crystal_handler.vader b/test/handler/test_crystal_handler.vader
index a7b7f3ab..209632e9 100644
--- a/test/handler/test_crystal_handler.vader
+++ b/test/handler/test_crystal_handler.vader
@@ -16,3 +16,13 @@ Execute(The crystal handler should parse lines correctly and add the column if i
\ ale_linters#crystal#crystal#Handle(255, [
\ '[{"file":"/tmp/test.cr","line":2,"column":1,"size":null,"message":"unexpected token: EOF"}]'
\ ])
+
+Execute(The crystal handler should not fail when a missing file is required):
+ AssertEqual
+ \ [ { 'lnum':1, 'col': 1, 'text': 'while requiring "./nonexistent.cr"' } ],
+ \ ale_linters#crystal#crystal#Handle(255,
+ \ json_encode([
+ \ { "file":"/tmp/file.cr","line":1,"column":1,"size":0,"message":"while requiring \"./nonexistent.cr\"" },
+ \ { "message": "can't find file './nonexistent.cr' relative to '/tmp'" },
+ \ ])
+ \ )