summaryrefslogtreecommitdiff
path: root/test/handler/test_elmmake_handler.vader
diff options
context:
space:
mode:
Diffstat (limited to 'test/handler/test_elmmake_handler.vader')
-rw-r--r--test/handler/test_elmmake_handler.vader201
1 files changed, 99 insertions, 102 deletions
diff --git a/test/handler/test_elmmake_handler.vader b/test/handler/test_elmmake_handler.vader
index 41c9646f..f5906a8b 100644
--- a/test/handler/test_elmmake_handler.vader
+++ b/test/handler/test_elmmake_handler.vader
@@ -1,10 +1,7 @@
Before:
- let b:tmp = has('win32') ? substitute($TMP, '\\', '\\\\', 'g') : $TMPDIR
-
runtime ale_linters/elm/make.vim
After:
- unlet! b:tmp
unlet! g:config_error_lines
call ale#linter#Reset()
@@ -22,12 +19,12 @@ Execute(The elm-make handler should parse Elm 0.19 general problems correctly):
\ }
\ ],
\ ale_linters#elm#make#Handle(347, [
- \ '{
- \ "type": "error",
- \ "path": "' . b:tmp . '/Module.elm",
- \ "title": "UNKNOWN IMPORT",
- \ "message": ["error details\n\n", { "string": "styled details" }]
- \ }'
+ \ json_encode({
+ \ 'type': 'error',
+ \ 'path': ale#util#Tempname() . '/Module.elm',
+ \ 'title': 'UNKNOWN IMPORT',
+ \ 'message': ["error details\n\n", { 'string': 'styled details' }]
+ \ }),
\ ])
Execute(The elm-make handler should parse Elm 0.19 compilation errors correctly):
@@ -47,7 +44,7 @@ Execute(The elm-make handler should parse Elm 0.19 compilation errors correctly)
\ 'end_lnum': 407,
\ 'end_col': 17,
\ 'type': 'E',
- \ 'text': "error details 2",
+ \ 'text': 'error details 2',
\ },
\ {
\ 'lnum': 406,
@@ -55,35 +52,35 @@ Execute(The elm-make handler should parse Elm 0.19 compilation errors correctly)
\ 'end_lnum': 406,
\ 'end_col': 93,
\ 'type': 'E',
- \ 'text': "error details 3",
+ \ 'text': 'error details 3',
\ },
\ ],
\ ale_linters#elm#make#Handle(347, [
- \ '{
- \ "type": "compile-errors",
- \ "errors": [
+ \ json_encode({
+ \ 'type': 'compile-errors',
+ \ 'errors': [
\ {
- \ "path": "' . b:tmp . '/Module.elm",
- \ "problems": [
+ \ 'path': ale#util#Tempname() . '/Module.elm',
+ \ 'problems': [
\ {
- \ "title": "TYPE MISMATCH",
- \ "message": ["error details 1\n\n", { "string": "styled details" }],
- \ "region": { "start": { "line": 404, "column": 1 }, "end": { "line": 408, "column": 18 } }
+ \ 'title': 'TYPE MISMATCH',
+ \ 'message': ["error details 1\n\n", { 'string': 'styled details' }],
+ \ 'region': { 'start': { 'line': 404, 'column': 1 }, 'end': { 'line': 408, 'column': 18 } }
\ },
\ {
- \ "title": "TYPE MISMATCH",
- \ "message": ["error details 2"],
- \ "region": { "start": {"line": 406, "column": 5}, "end": {"line": 407, "column": 17 } }
+ \ 'title': 'TYPE MISMATCH',
+ \ 'message': ['error details 2'],
+ \ 'region': { 'start': {'line': 406, 'column': 5}, 'end': {'line': 407, 'column': 17 } }
\ },
\ {
- \ "title": "TYPE MISMATCH",
- \ "message": ["error details 3"],
- \ "region": { "start": { "line": 406, "column": 5}, "end": {"line": 406, "column": 93 } }
+ \ 'title': 'TYPE MISMATCH',
+ \ 'message': ['error details 3'],
+ \ 'region': { 'start': { 'line': 406, 'column': 5}, 'end': {'line': 406, 'column': 93 } }
\ }
\ ]
\ }
\ ]
- \ }'
+ \ }),
\ ])
Execute(The elm-make handler should handle errors in Elm 0.19 imported modules):
@@ -109,33 +106,33 @@ Execute(The elm-make handler should handle errors in Elm 0.19 imported modules):
\ },
\ ],
\ ale_linters#elm#make#Handle(347, [
- \ '{
- \ "type": "error",
- \ "path": "src/Module.elm",
- \ "title": "UNKNOWN IMPORT",
- \ "message": ["error details\n\n", { "string": "styled details" }]
- \ }',
- \ '{
- \ "type": "error",
- \ "path": null,
- \ "title": "UNKNOWN IMPORT",
- \ "message": ["error details\n\n", { "string": "styled details" }]
- \ }',
- \ '{
- \ "type": "compile-errors",
- \ "errors": [
+ \ json_encode({
+ \ 'type': 'error',
+ \ 'path': 'src/Module.elm',
+ \ 'title': 'UNKNOWN IMPORT',
+ \ 'message': ["error details\n\n", { 'string': 'styled details' }]
+ \ }),
+ \ json_encode({
+ \ 'type': 'error',
+ \ 'path': v:null,
+ \ 'title': 'UNKNOWN IMPORT',
+ \ 'message': ["error details\n\n", { 'string': 'styled details' }]
+ \ }),
+ \ json_encode({
+ \ 'type': 'compile-errors',
+ \ 'errors': [
\ {
- \ "path": "src/Module.elm",
- \ "problems": [
+ \ 'path': 'src/Module.elm',
+ \ 'problems': [
\ {
- \ "title": "TYPE MISMATCH",
- \ "message": ["error details\n\n", { "string": "styled details" }],
- \ "region": { "start": { "line": 404, "column": 1 }, "end": { "line": 408, "column": 18 } }
+ \ 'title': 'TYPE MISMATCH',
+ \ 'message': ["error details\n\n", { 'string': 'styled details' }],
+ \ 'region': { 'start': { 'line': 404, 'column': 1 }, 'end': { 'line': 408, 'column': 18 } }
\ }
\ ]
\ }
\ ]
- \ }'
+ \ }),
\ ])
@@ -182,45 +179,45 @@ Execute(The elm-make handler should parse Elm 0.18 compilation errors correctly)
\ },
\ ],
\ ale_linters#elm#make#Handle(347, [
- \ '[
+ \ json_encode([
\ {
- \ "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': 'unused import',
+ \ 'overview': 'warning overview',
+ \ 'details': 'warning details',
+ \ 'region': {'start': { 'line': 33, 'column': 1 }, 'end': { 'line': 33, 'column': 19 } },
+ \ 'type': 'warning',
+ \ 'file': ale#util#Tempname() . '/Module.elm',
\ }
- \ ]',
- \ '[
+ \ ]),
+ \ json_encode([
\ {
- \ "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 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': ale#util#Tempname() . '/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 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': ale#util#Tempname() . '/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"
+ \ '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': ale#util#Tempname() . '/Module.elm',
\ }
- \ ]'
+ \ ]),
\ ])
Execute(The elm-make handler should handle errors in Elm 0.18 imported modules):
@@ -229,29 +226,29 @@ Execute(The elm-make handler should handle errors in Elm 0.18 imported modules):
\ {
\ 'lnum': 1,
\ 'type': 'E',
- \ 'text': "src/Module.elm:33 - error overview",
+ \ 'text': 'src/Module.elm:33 - error overview',
\ 'detail': "src/Module.elm:33 ----------\n\nerror overview\n\nerror details"
\ }
\ ],
\ ale_linters#elm#make#Handle(347, [
- \ '[
+ \ json_encode([
\ {
- \ "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': '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"
+ \ '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
@@ -275,21 +272,21 @@ Execute(The elm-make handler should put an error on the first line if a line can
\ },
\ ],
\ ale_linters#elm#make#Handle(347, [
- \ '{
- \ "type": "compile-errors",
- \ "errors": [
+ \ json_encode({
+ \ 'type': 'compile-errors',
+ \ 'errors': [
\ {
- \ "path": "' . b:tmp . '/Module.elm",
- \ "problems": [
+ \ 'path': ale#util#Tempname() . '/Module.elm',
+ \ 'problems': [
\ {
- \ "title": "TYPE MISMATCH",
- \ "message": ["error details 1\n\n", { "string": "styled details" }],
- \ "region": { "start": { "line": 404, "column": 1 }, "end": { "line": 408, "column": 18 } }
+ \ 'title': 'TYPE MISMATCH',
+ \ 'message': ["error details 1\n\n", { 'string': 'styled details' }],
+ \ 'region': { 'start': { 'line': 404, 'column': 1 }, 'end': { 'line': 408, 'column': 18 } }
\ }
\ ]
\ }
\ ]
- \ }',
+ \ }),
\ 'Not JSON',
\ 'Also not JSON',
\ ])