2017-06-25 16:12:40 +00:00
|
|
|
Before:
|
2017-09-11 21:25:15 +00:00
|
|
|
let b:tmp = has('win32') ? substitute($TMP, '\\', '\\\\', 'g') : $TMPDIR
|
|
|
|
|
2017-06-25 16:12:40 +00:00
|
|
|
runtime ale_linters/elm/make.vim
|
|
|
|
|
2017-09-11 21:25:15 +00:00
|
|
|
After:
|
|
|
|
unlet! b:tmp
|
|
|
|
unlet! g:config_error_lines
|
|
|
|
|
|
|
|
call ale#linter#Reset()
|
|
|
|
|
2018-05-15 15:06:52 +00:00
|
|
|
|
|
|
|
" Elm 0.19
|
|
|
|
|
|
|
|
Execute(The elm-make handler should parse Elm 0.19 general problems correctly):
|
2018-05-11 18:07:28 +00:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'type': 'E',
|
2018-05-12 02:16:14 +00:00
|
|
|
\ 'text': "error details\n\nstyled details"
|
2018-05-11 18:07:28 +00:00
|
|
|
\ }
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#elm#make#Handle(347, [
|
|
|
|
\ '{
|
|
|
|
\ "type": "error",
|
|
|
|
\ "path": "' . b:tmp . '/Module.elm",
|
|
|
|
\ "title": "UNKNOWN IMPORT",
|
2018-05-12 02:16:14 +00:00
|
|
|
\ "message": ["error details\n\n", { "string": "styled details" }]
|
2018-05-11 18:07:28 +00:00
|
|
|
\ }'
|
|
|
|
\ ])
|
|
|
|
|
2018-05-15 15:06:52 +00:00
|
|
|
Execute(The elm-make handler should parse Elm 0.19 compilation errors correctly):
|
2017-06-25 16:12:40 +00:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 404,
|
|
|
|
\ 'col': 1,
|
2017-06-26 13:37:04 +00:00
|
|
|
\ 'end_lnum': 408,
|
|
|
|
\ 'end_col': 18,
|
2017-06-25 16:12:40 +00:00
|
|
|
\ 'type': 'E',
|
2018-05-12 02:16:14 +00:00
|
|
|
\ 'text': "error details 1\n\nstyled details"
|
2017-06-25 16:12:40 +00:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 406,
|
|
|
|
\ 'col': 5,
|
2017-06-26 13:37:04 +00:00
|
|
|
\ 'end_lnum': 407,
|
|
|
|
\ 'end_col': 17,
|
2017-06-25 16:12:40 +00:00
|
|
|
\ 'type': 'E',
|
2018-05-12 02:16:14 +00:00
|
|
|
\ 'text': "error details 2",
|
2017-06-25 16:12:40 +00:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 406,
|
|
|
|
\ 'col': 5,
|
2017-06-26 13:37:04 +00:00
|
|
|
\ 'end_lnum': 406,
|
|
|
|
\ 'end_col': 93,
|
2017-06-25 16:12:40 +00:00
|
|
|
\ 'type': 'E',
|
2018-05-12 02:16:14 +00:00
|
|
|
\ 'text': "error details 3",
|
2017-06-25 16:12:40 +00:00
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#elm#make#Handle(347, [
|
2018-05-11 17:15:40 +00:00
|
|
|
\ '{
|
2018-05-11 18:07:28 +00:00
|
|
|
\ "type": "compile-errors",
|
2018-05-11 17:15:40 +00:00
|
|
|
\ "errors": [
|
|
|
|
\ {
|
2018-05-11 18:07:28 +00:00
|
|
|
\ "path": "' . b:tmp . '/Module.elm",
|
2018-05-11 17:15:40 +00:00
|
|
|
\ "problems": [
|
|
|
|
\ {
|
|
|
|
\ "title": "TYPE MISMATCH",
|
2018-05-11 18:07:28 +00:00
|
|
|
\ "message": ["error details 1\n\n", { "string": "styled details" }],
|
|
|
|
\ "region": { "start": { "line": 404, "column": 1 }, "end": { "line": 408, "column": 18 } }
|
2018-05-11 17:15:40 +00:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ "title": "TYPE MISMATCH",
|
|
|
|
\ "message": ["error details 2"],
|
2018-05-11 18:07:28 +00:00
|
|
|
\ "region": { "start": {"line": 406, "column": 5}, "end": {"line": 407, "column": 17 } }
|
2018-05-11 17:15:40 +00:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ "title": "TYPE MISMATCH",
|
|
|
|
\ "message": ["error details 3"],
|
2018-05-11 18:07:28 +00:00
|
|
|
\ "region": { "start": { "line": 406, "column": 5}, "end": {"line": 406, "column": 93 } }
|
|
|
|
\ }
|
|
|
|
\ ]
|
|
|
|
\ }
|
|
|
|
\ ]
|
|
|
|
\ }'
|
|
|
|
\ ])
|
|
|
|
|
2018-05-15 15:06:52 +00:00
|
|
|
Execute(The elm-make handler should handle errors in Elm 0.19 imported modules):
|
2018-05-11 18:07:28 +00:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'type': 'E',
|
2018-05-12 02:16:14 +00:00
|
|
|
\ 'text': "src/Module.elm - error details\n\nstyled details",
|
|
|
|
\ 'detail': "src/Module.elm ----------\n\nerror details\n\nstyled details"
|
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'type': 'E',
|
2018-05-15 15:06:52 +00:00
|
|
|
\ 'text': "Elm - error details\n\nstyled details",
|
|
|
|
\ 'detail': "Elm ----------\n\nerror details\n\nstyled details"
|
2018-05-12 18:27:33 +00:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'type': 'E',
|
2018-05-12 02:16:14 +00:00
|
|
|
\ 'text': "src/Module.elm:404 - error details\n\nstyled details",
|
|
|
|
\ 'detail': "src/Module.elm:404 ----------\n\nerror details\n\nstyled details"
|
2018-05-11 18:07:28 +00:00
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#elm#make#Handle(347, [
|
|
|
|
\ '{
|
2018-05-12 02:16:14 +00:00
|
|
|
\ "type": "error",
|
|
|
|
\ "path": "src/Module.elm",
|
|
|
|
\ "title": "UNKNOWN IMPORT",
|
|
|
|
\ "message": ["error details\n\n", { "string": "styled details" }]
|
|
|
|
\ }',
|
|
|
|
\ '{
|
2018-05-12 18:27:33 +00:00
|
|
|
\ "type": "error",
|
|
|
|
\ "path": null,
|
|
|
|
\ "title": "UNKNOWN IMPORT",
|
|
|
|
\ "message": ["error details\n\n", { "string": "styled details" }]
|
|
|
|
\ }',
|
|
|
|
\ '{
|
2018-05-11 18:07:28 +00:00
|
|
|
\ "type": "compile-errors",
|
|
|
|
\ "errors": [
|
|
|
|
\ {
|
|
|
|
\ "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 } }
|
2018-05-11 17:15:40 +00:00
|
|
|
\ }
|
|
|
|
\ ]
|
|
|
|
\ }
|
|
|
|
\ ]
|
|
|
|
\ }'
|
2017-06-25 16:12:40 +00:00
|
|
|
\ ])
|
|
|
|
|
2018-05-15 15:06:52 +00:00
|
|
|
|
|
|
|
" 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):
|
2017-06-25 16:12:40 +00:00
|
|
|
AssertEqual
|
|
|
|
\ [
|
|
|
|
\ {
|
2018-05-11 17:15:40 +00:00
|
|
|
\ 'lnum': 404,
|
2017-06-25 16:12:40 +00:00
|
|
|
\ 'col': 1,
|
2018-05-11 17:15:40 +00:00
|
|
|
\ 'end_lnum': 408,
|
|
|
|
\ 'end_col': 18,
|
|
|
|
\ 'type': 'E',
|
2018-05-12 02:16:14 +00:00
|
|
|
\ 'text': "error details 1\n\nstyled details"
|
2017-06-25 16:12:40 +00:00
|
|
|
\ },
|
|
|
|
\ {
|
|
|
|
\ 'lnum': 1,
|
|
|
|
\ 'type': 'E',
|
|
|
|
\ 'text': 'Not JSON',
|
|
|
|
\ 'detail': "Not JSON\nAlso not JSON",
|
|
|
|
\ },
|
|
|
|
\ ],
|
|
|
|
\ ale_linters#elm#make#Handle(347, [
|
2018-05-11 17:15:40 +00:00
|
|
|
\ '{
|
2018-05-11 18:07:28 +00:00
|
|
|
\ "type": "compile-errors",
|
2018-05-11 17:15:40 +00:00
|
|
|
\ "errors": [
|
|
|
|
\ {
|
2018-05-11 18:07:28 +00:00
|
|
|
\ "path": "' . b:tmp . '/Module.elm",
|
2018-05-11 17:15:40 +00:00
|
|
|
\ "problems": [
|
|
|
|
\ {
|
|
|
|
\ "title": "TYPE MISMATCH",
|
2018-05-12 02:16:14 +00:00
|
|
|
\ "message": ["error details 1\n\n", { "string": "styled details" }],
|
2018-05-11 18:07:28 +00:00
|
|
|
\ "region": { "start": { "line": 404, "column": 1 }, "end": { "line": 408, "column": 18 } }
|
2018-05-11 17:15:40 +00:00
|
|
|
\ }
|
|
|
|
\ ]
|
|
|
|
\ }
|
|
|
|
\ ]
|
|
|
|
\ }',
|
2018-05-12 02:16:14 +00:00
|
|
|
\ 'Not JSON',
|
|
|
|
\ 'Also not JSON',
|
2017-06-25 16:12:40 +00:00
|
|
|
\ ])
|
2018-05-15 15:06:52 +00:00
|
|
|
|
|
|
|
Execute(The elm-make handler should ignore success lines):
|
|
|
|
AssertEqual
|
|
|
|
\ [],
|
|
|
|
\ ale_linters#elm#make#Handle(347, [
|
|
|
|
\ 'Successfully generated /dev/null',
|
|
|
|
\ ])
|