mirror of
https://github.com/dense-analysis/ale.git
synced 2025-12-06 20:54:26 +08:00
@@ -9,7 +9,139 @@ After:
|
||||
|
||||
call ale#linter#Reset()
|
||||
|
||||
Execute(The elm-make handler should parse lines correctly):
|
||||
|
||||
" Elm 0.19
|
||||
|
||||
Execute(The elm-make handler should parse Elm 0.19 general problems correctly):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'type': 'E',
|
||||
\ 'text': "error details\n\nstyled details"
|
||||
\ }
|
||||
\ ],
|
||||
\ ale_linters#elm#make#Handle(347, [
|
||||
\ '{
|
||||
\ "type": "error",
|
||||
\ "path": "' . b:tmp . '/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):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 404,
|
||||
\ 'col': 1,
|
||||
\ 'end_lnum': 408,
|
||||
\ 'end_col': 18,
|
||||
\ 'type': 'E',
|
||||
\ 'text': "error details 1\n\nstyled details"
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 406,
|
||||
\ 'col': 5,
|
||||
\ 'end_lnum': 407,
|
||||
\ 'end_col': 17,
|
||||
\ 'type': 'E',
|
||||
\ 'text': "error details 2",
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 406,
|
||||
\ 'col': 5,
|
||||
\ 'end_lnum': 406,
|
||||
\ 'end_col': 93,
|
||||
\ 'type': 'E',
|
||||
\ 'text': "error details 3",
|
||||
\ },
|
||||
\ ],
|
||||
\ ale_linters#elm#make#Handle(347, [
|
||||
\ '{
|
||||
\ "type": "compile-errors",
|
||||
\ "errors": [
|
||||
\ {
|
||||
\ "path": "' . b:tmp . '/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 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 } }
|
||||
\ }
|
||||
\ ]
|
||||
\ }
|
||||
\ ]
|
||||
\ }'
|
||||
\ ])
|
||||
|
||||
Execute(The elm-make handler should handle errors in Elm 0.19 imported modules):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'type': 'E',
|
||||
\ 'text': "src/Module.elm - error details\n\nstyled details",
|
||||
\ 'detail': "src/Module.elm ----------\n\nerror details\n\nstyled details"
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'type': 'E',
|
||||
\ 'text': "Elm - error details\n\nstyled details",
|
||||
\ 'detail': "Elm ----------\n\nerror details\n\nstyled details"
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
\ 'type': 'E',
|
||||
\ 'text': "src/Module.elm:404 - error details\n\nstyled details",
|
||||
\ 'detail': "src/Module.elm:404 ----------\n\nerror details\n\nstyled details"
|
||||
\ },
|
||||
\ ],
|
||||
\ 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": [
|
||||
\ {
|
||||
\ "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 } }
|
||||
\ }
|
||||
\ ]
|
||||
\ }
|
||||
\ ]
|
||||
\ }'
|
||||
\ ])
|
||||
|
||||
|
||||
" Elm 0.18
|
||||
|
||||
Execute(The elm-make handler should parse Elm 0.18 compilation errors correctly):
|
||||
AssertEqual
|
||||
\ [
|
||||
\ {
|
||||
@@ -50,21 +182,90 @@ Execute(The elm-make handler should parse lines correctly):
|
||||
\ },
|
||||
\ ],
|
||||
\ 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"}]'
|
||||
\ '[
|
||||
\ {
|
||||
\ "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
|
||||
\ [
|
||||
\ {
|
||||
\ 'lnum': 33,
|
||||
\ 'lnum': 404,
|
||||
\ 'col': 1,
|
||||
\ 'end_lnum': 33,
|
||||
\ 'end_col': 19,
|
||||
\ 'type': 'W',
|
||||
\ 'text': 'warning overview',
|
||||
\ 'detail': "warning overview\n\nwarning details",
|
||||
\ 'end_lnum': 408,
|
||||
\ 'end_col': 18,
|
||||
\ 'type': 'E',
|
||||
\ 'text': "error details 1\n\nstyled details"
|
||||
\ },
|
||||
\ {
|
||||
\ 'lnum': 1,
|
||||
@@ -74,7 +275,28 @@ Execute(The elm-make handler should put an error on the first line if a line can
|
||||
\ },
|
||||
\ ],
|
||||
\ 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"}]',
|
||||
\ "Not JSON",
|
||||
\ "Also not JSON",
|
||||
\ '{
|
||||
\ "type": "compile-errors",
|
||||
\ "errors": [
|
||||
\ {
|
||||
\ "path": "' . b:tmp . '/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 } }
|
||||
\ }
|
||||
\ ]
|
||||
\ }
|
||||
\ ]
|
||||
\ }',
|
||||
\ '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',
|
||||
\ ])
|
||||
|
||||
@@ -12,7 +12,7 @@ Execute(should get valid executable with default params):
|
||||
call ale#test#SetFilename('elm-test-files/app/testfile.elm')
|
||||
|
||||
AssertEqual
|
||||
\ ale#path#Simplify(g:dir . '/elm-test-files/app/node_modules/.bin/elm-make'),
|
||||
\ ale#path#Simplify(g:dir . '/elm-test-files/app/node_modules/.bin/elm'),
|
||||
\ ale_linters#elm#make#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(should get valid executable with 'use_global' params):
|
||||
@@ -21,16 +21,16 @@ Execute(should get valid executable with 'use_global' params):
|
||||
call ale#test#SetFilename('elm-test-files/app/testfile.elm')
|
||||
|
||||
AssertEqual
|
||||
\ 'elm-make',
|
||||
\ 'elm',
|
||||
\ ale_linters#elm#make#GetExecutable(bufnr(''))
|
||||
|
||||
Execute(should get valid executable with 'use_global' and 'executable' params):
|
||||
let g:ale_elm_make_executable = 'other-elm-make'
|
||||
let g:ale_elm_make_executable = 'other-elm'
|
||||
let g:ale_elm_make_use_global = 1
|
||||
|
||||
call ale#test#SetFilename('elm-test-files/app/testfile.elm')
|
||||
|
||||
AssertEqual
|
||||
\ 'other-elm-make',
|
||||
\ 'other-elm',
|
||||
\ ale_linters#elm#make#GetExecutable(bufnr(''))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user