diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/elm-test-files/app/node_modules/.bin/elm (renamed from test/elm-test-files/app/node_modules/.bin/elm-make) | 0 | ||||
-rw-r--r-- | test/handler/test_elmmake_handler.vader | 80 | ||||
-rw-r--r-- | test/test_elm_executable_detection.vader | 16 |
3 files changed, 62 insertions, 34 deletions
diff --git a/test/elm-test-files/app/node_modules/.bin/elm-make b/test/elm-test-files/app/node_modules/.bin/elm index e69de29b..e69de29b 100644 --- a/test/elm-test-files/app/node_modules/.bin/elm-make +++ b/test/elm-test-files/app/node_modules/.bin/elm diff --git a/test/handler/test_elmmake_handler.vader b/test/handler/test_elmmake_handler.vader index f3424b4b..94bd84ad 100644 --- a/test/handler/test_elmmake_handler.vader +++ b/test/handler/test_elmmake_handler.vader @@ -13,22 +13,13 @@ Execute(The elm-make handler should parse lines 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", + \ 'text': 'TYPE MISMATCH', + \ 'detail': "error details 1 styled details" \ }, \ { \ 'lnum': 406, @@ -36,8 +27,8 @@ Execute(The elm-make handler should parse lines correctly): \ 'end_lnum': 407, \ 'end_col': 17, \ 'type': 'E', - \ 'text': 'error overview 2', - \ 'detail': "error overview 2\n\nerror details 2", + \ 'text': 'TYPE MISMATCH', + \ 'detail': "error details 2", \ }, \ { \ 'lnum': 406, @@ -45,26 +36,49 @@ Execute(The elm-make handler should parse lines correctly): \ 'end_lnum': 406, \ 'end_col': 93, \ 'type': 'E', - \ 'text': 'error overview 3', - \ 'detail': "error overview 3\n\nerror details 3", + \ 'text': 'TYPE MISMATCH', + \ 'detail': "error 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"}]' + \ '{ + \ "type":"compile-errors", + \ "errors": [ + \ { + \ "path": "' . b:tmp . 'Module.elm", + \ "problems": [ + \ { + \ "title": "TYPE MISMATCH", + \ "message": ["error details 1 ", { "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 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': 'TYPE MISMATCH', + \ 'detail': "error details 1 styled details" \ }, \ { \ 'lnum': 1, @@ -74,7 +88,21 @@ 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 ", { "string": "styled details" }], + \ "region": { "start": { "line": 404, "column":1 }, "end": { "line":408, "column":18} } + \ } + \ ] + \ } + \ ] + \ }', + \ "Not JSON", + \ "Also not JSON", \ ]) diff --git a/test/test_elm_executable_detection.vader b/test/test_elm_executable_detection.vader index 4227cbfa..c17d1bbc 100644 --- a/test/test_elm_executable_detection.vader +++ b/test/test_elm_executable_detection.vader @@ -3,8 +3,8 @@ Before: runtime ale_linters/elm/make.vim After: - unlet! g:ale_elm_make_use_global - unlet! g:ale_elm_make_executable + unlet! g:ale_elm_use_global + unlet! g:ale_elm_executable call ale#test#RestoreDirectory() @@ -12,25 +12,25 @@ 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): - let g:ale_elm_make_use_global = 1 + let g:ale_elm_use_global = 1 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_use_global = 1 + let g:ale_elm_executable = 'other-elm' + let g:ale_elm_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('')) |