mirror of
https://github.com/dense-analysis/ale.git
synced 2026-01-10 05:22:31 +08:00
Add fsc linter for Scala (#1452)
* Add fsc as a Scala linter * Pull reused code into `autoload/ale/` directory * Include fsc into the README * Add unit test for testing the scala handler * Add unit test for scala's fsc linter * Rename scala unit tests for clarity * Fix typo in README * Fix typos in doc/ale.txt * Fix author headline * Put methods for fsc commands back into fsc.vim * Move command_callback tests to correct location * Rewrite handler test so it actually tests handler * Clarify description of test in test_scala_handler
This commit is contained in:
32
test/handler/test_scala_handler.vader
Normal file
32
test/handler/test_scala_handler.vader
Normal file
@@ -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",
|
||||
\ ])
|
||||
@@ -1,18 +0,0 @@
|
||||
Before:
|
||||
runtime ale_linters/scala/scalac.vim
|
||||
|
||||
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
|
||||
\ ale#Escape('scalac') . ' -Ystop-after:parser %t',
|
||||
\ ale_linters#scala#scalac#GetCommand(bufnr(''))
|
||||
|
||||
Given scala.sbt(An empty SBT file):
|
||||
Execute(scalac should not be run for sbt files):
|
||||
AssertEqual '', ale_linters#scala#scalac#GetExecutable(bufnr(''))
|
||||
AssertEqual '', ale_linters#scala#scalac#GetCommand(bufnr(''))
|
||||
Reference in New Issue
Block a user