diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/command_callback/test_fsc_command_callback.vader | 17 | ||||
-rw-r--r-- | test/command_callback/test_scalac_command_callback.vader (renamed from test/handler/test_scalac_handler.vader) | 1 | ||||
-rw-r--r-- | test/handler/test_scala_handler.vader | 32 |
3 files changed, 49 insertions, 1 deletions
diff --git a/test/command_callback/test_fsc_command_callback.vader b/test/command_callback/test_fsc_command_callback.vader new file mode 100644 index 00000000..451fa108 --- /dev/null +++ b/test/command_callback/test_fsc_command_callback.vader @@ -0,0 +1,17 @@ +Before: + runtime ale_linters/scala/fsc.vim + +After: + call ale#linter#Reset() + +Given scala(An empty Scala file): +Execute(The default executable and command should be correct): + AssertEqual 'fsc', ale_linters#scala#fsc#GetExecutable(bufnr('')) + AssertEqual + \ ale#Escape('fsc') . ' -Ystop-after:parser %t', + \ ale_linters#scala#fsc#GetCommand(bufnr('')) + +Given scala.sbt(An empty SBT file): +Execute(fsc should not be run for sbt files): + AssertEqual '', ale_linters#scala#fsc#GetExecutable(bufnr('')) + AssertEqual '', ale_linters#scala#fsc#GetCommand(bufnr('')) diff --git a/test/handler/test_scalac_handler.vader b/test/command_callback/test_scalac_command_callback.vader index fd222f67..6bb31b3f 100644 --- a/test/handler/test_scalac_handler.vader +++ b/test/command_callback/test_scalac_command_callback.vader @@ -5,7 +5,6 @@ After: call ale#linter#Reset() Given scala(An empty Scala file): - Execute(The default executable and command should be correct): AssertEqual 'scalac', ale_linters#scala#scalac#GetExecutable(bufnr('')) AssertEqual diff --git a/test/handler/test_scala_handler.vader b/test/handler/test_scala_handler.vader new file mode 100644 index 00000000..3214bdbc --- /dev/null +++ b/test/handler/test_scala_handler.vader @@ -0,0 +1,32 @@ +After: + call ale#linter#Reset() + +Execute(The handler should return an empty list with empty input): + AssertEqual [], ale#handlers#scala#HandleScalacLintFormat(bufnr(''), []) + +Execute(The handler should correctly parse error messages): + AssertEqual + \ [ + \ { + \ 'lnum': 4, + \ 'col': 8, + \ 'text': ''':'' expected but identifier found.', + \ 'type': 'E' + \ }, + \ { + \ 'lnum': 6, + \ 'col': 2, + \ 'text': 'identifier expected but eof found.', + \ 'type': 'E' + \ } + \ ], + \ ale#handlers#scala#HandleScalacLintFormat(bufnr(''), + \ [ + \ "hi.scala:4: error: ':' expected but identifier found.", + \ " Some stupid scala code", + \ " ^", + \ "hi.scala:6: error: identifier expected but eof found.", + \ ")", + \ " ^", + \ "two errors found", + \ ]) |