summaryrefslogtreecommitdiff
path: root/test/handler/test_elmmake_handler.vader
diff options
context:
space:
mode:
authorHéctor Ramón Jiménez <hector0193@gmail.com>2018-05-15 17:06:52 +0200
committerHéctor Ramón Jiménez <hector0193@gmail.com>2018-05-15 17:06:52 +0200
commitb071f1a79587522ea6782c27d7caab8ff88c1bb3 (patch)
tree9c9acf2586b5c2b6d3272897585972e19595e4e9 /test/handler/test_elmmake_handler.vader
parent115952fae39a70f7b2eee5014da047bc7542816d (diff)
downloadale-b071f1a79587522ea6782c27d7caab8ff88c1bb3.zip
Make Elm linter backwards compatible with Elm 0.18
Diffstat (limited to 'test/handler/test_elmmake_handler.vader')
-rw-r--r--test/handler/test_elmmake_handler.vader140
1 files changed, 134 insertions, 6 deletions
diff --git a/test/handler/test_elmmake_handler.vader b/test/handler/test_elmmake_handler.vader
index 8abe3295..41c9646f 100644
--- a/test/handler/test_elmmake_handler.vader
+++ b/test/handler/test_elmmake_handler.vader
@@ -9,7 +9,10 @@ After:
call ale#linter#Reset()
-Execute(The elm make handler should parse general problems correctly):
+
+" Elm 0.19
+
+Execute(The elm-make handler should parse Elm 0.19 general problems correctly):
AssertEqual
\ [
\ {
@@ -27,7 +30,7 @@ Execute(The elm make handler should parse general problems correctly):
\ }'
\ ])
-Execute(The elm make handler should parse compilation errors correctly):
+Execute(The elm-make handler should parse Elm 0.19 compilation errors correctly):
AssertEqual
\ [
\ {
@@ -83,7 +86,7 @@ Execute(The elm make handler should parse compilation errors correctly):
\ }'
\ ])
-Execute(The elm make handler should handle errors in imported modules):
+Execute(The elm-make handler should handle errors in Elm 0.19 imported modules):
AssertEqual
\ [
\ {
@@ -95,8 +98,8 @@ Execute(The elm make handler should handle errors in imported modules):
\ {
\ 'lnum': 1,
\ 'type': 'E',
- \ 'text': "Elm.Kernel - error details\n\nstyled details",
- \ 'detail': "Elm.Kernel ----------\n\nerror details\n\nstyled details"
+ \ 'text': "Elm - error details\n\nstyled details",
+ \ 'detail': "Elm ----------\n\nerror details\n\nstyled details"
\ },
\ {
\ 'lnum': 1,
@@ -135,7 +138,125 @@ Execute(The elm make handler should handle errors in imported modules):
\ }'
\ ])
-Execute(The elm make handler should put an error on the first line if a line cannot be parsed):
+
+" Elm 0.18
+
+Execute(The elm-make handler should parse Elm 0.18 compilation errors correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 33,
+ \ 'col': 1,
+ \ 'end_lnum': 33,
+ \ 'end_col': 19,
+ \ 'type': 'W',
+ \ 'text': 'warning overview',
+ \ 'detail': "warning overview\n\nwarning details",
+ \ },
+ \ {
+ \ 'lnum': 404,
+ \ 'col': 1,
+ \ 'end_lnum': 408,
+ \ 'end_col': 18,
+ \ 'type': 'E',
+ \ 'text': 'error overview 1',
+ \ 'detail': "error overview 1\n\nerror details 1",
+ \ },
+ \ {
+ \ 'lnum': 406,
+ \ 'col': 5,
+ \ 'end_lnum': 407,
+ \ 'end_col': 17,
+ \ 'type': 'E',
+ \ 'text': 'error overview 2',
+ \ 'detail': "error overview 2\n\nerror details 2",
+ \ },
+ \ {
+ \ 'lnum': 406,
+ \ 'col': 5,
+ \ 'end_lnum': 406,
+ \ 'end_col': 93,
+ \ 'type': 'E',
+ \ 'text': 'error overview 3',
+ \ 'detail': "error overview 3\n\nerror details 3",
+ \ },
+ \ ],
+ \ ale_linters#elm#make#Handle(347, [
+ \ '[
+ \ {
+ \ "tag": "unused import",
+ \ "overview": "warning overview",
+ \ "details": "warning details",
+ \ "region": {"start": { "line": 33, "column": 1 }, "end": { "line": 33, "column": 19 } },
+ \ "type": "warning",
+ \ "file": "' . b:tmp . '/Module.elm"
+ \ }
+ \ ]',
+ \ '[
+ \ {
+ \ "tag": "TYPE MISMATCH",
+ \ "overview": "error overview 1",
+ \ "subregion": { "start": { "line": 406, "column": 5 }, "end": { "line": 408, "column": 18 } },
+ \ "details": "error details 1",
+ \ "region": { "start": { "line": 404, "column": 1 }, "end": { "line": 408, "column": 18 } },
+ \ "type": "error",
+ \ "file":"' . b:tmp . '/Module.elm"
+ \ },
+ \ {
+ \ "tag": "TYPE MISMATCH",
+ \ "overview": "error overview 2",
+ \ "subregion": { "start": { "line": 407, "column": 12 }, "end": { "line": 407, "column": 17 } },
+ \ "details": "error details 2",
+ \ "region": { "start": { "line": 406, "column": 5}, "end": { "line": 407, "column": 17 } },
+ \ "type":"error",
+ \ "file":"' . b:tmp . '/Module.elm"
+ \ },
+ \ {
+ \ "tag": "TYPE MISMATCH",
+ \ "overview": "error overview 3",
+ \ "subregion": { "start": { "line": 406, "column": 88 }, "end": { "line": 406, "column": 93 } },
+ \ "details": "error details 3",
+ \ "region": { "start": { "line": 406, "column": 5 }, "end": { "line": 406, "column": 93 } },
+ \ "type":"error",
+ \ "file":"' . b:tmp . '/Module.elm"
+ \ }
+ \ ]'
+ \ ])
+
+Execute(The elm-make handler should handle errors in Elm 0.18 imported modules):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'type': 'E',
+ \ 'text': "src/Module.elm:33 - error overview",
+ \ 'detail': "src/Module.elm:33 ----------\n\nerror overview\n\nerror details"
+ \ }
+ \ ],
+ \ ale_linters#elm#make#Handle(347, [
+ \ '[
+ \ {
+ \ "tag": "unused import",
+ \ "overview": "warning overview",
+ \ "details": "warning details",
+ \ "region": {"start": { "line": 33, "column": 1 }, "end": { "line": 33, "column": 19 } },
+ \ "type": "warning",
+ \ "file": "src/Module.elm"
+ \ },
+ \ {
+ \ "tag": "type error",
+ \ "overview": "error overview",
+ \ "details": "error details",
+ \ "region": {"start": { "line": 33, "column": 1 }, "end": { "line": 33, "column": 19 } },
+ \ "type": "error",
+ \ "file": "src/Module.elm"
+ \ }
+ \ ]',
+ \ ])
+
+" Generic
+
+Execute(The elm-make handler should put an error on the first line if a line cannot be parsed):
AssertEqual
\ [
\ {
@@ -172,3 +293,10 @@ Execute(The elm make handler should put an error on the first line if a line can
\ 'Not JSON',
\ 'Also not JSON',
\ ])
+
+Execute(The elm-make handler should ignore success lines):
+ AssertEqual
+ \ [],
+ \ ale_linters#elm#make#Handle(347, [
+ \ 'Successfully generated /dev/null',
+ \ ])