summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_scalastyle_command_callback.vader27
-rw-r--r--test/handler/test_scalastyle_handler.vader38
2 files changed, 65 insertions, 0 deletions
diff --git a/test/command_callback/test_scalastyle_command_callback.vader b/test/command_callback/test_scalastyle_command_callback.vader
new file mode 100644
index 00000000..f051b025
--- /dev/null
+++ b/test/command_callback/test_scalastyle_command_callback.vader
@@ -0,0 +1,27 @@
+Before:
+ runtime ale_linters/scala/scalastyle.vim
+
+After:
+ call ale#linter#Reset()
+ let g:ale_scala_scalastyle_options = ''
+ let g:ale_scalastyle_conf_loc = ''
+
+Execute(Should return the correct default command):
+ AssertEqual
+ \ 'scalastyle %t',
+ \ ale_linters#scala#scalastyle#GetCommand(bufnr(''))
+
+Execute(Should allow using a custom config file):
+ let g:ale_scalastyle_config_loc = '/dooper/config.xml'
+
+ AssertEqual
+ \ 'scalastyle --config ''/dooper/config.xml'' %t',
+ \ ale_linters#scala#scalastyle#GetCommand(bufnr(''))
+
+Execute(Should allow using custom options):
+ let g:ale_scala_scalastyle_options = '--warnings false --quiet true'
+
+ AssertEqual
+ \ 'scalastyle --config ''/dooper/config.xml'' --warnings false --quiet true %t',
+ \ ale_linters#scala#scalastyle#GetCommand(bufnr(''))
+
diff --git a/test/handler/test_scalastyle_handler.vader b/test/handler/test_scalastyle_handler.vader
new file mode 100644
index 00000000..b03d18e7
--- /dev/null
+++ b/test/handler/test_scalastyle_handler.vader
@@ -0,0 +1,38 @@
+Execute(The scalastyle handler should parse lines correctly):
+ runtime! ale_linters/scala/scalastyle.vim
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 190,
+ \ 'text': 'Missing or badly formed ScalaDoc: Missing @param str',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'lnum': 200,
+ \ 'col': 34,
+ \ 'text': 'There should be a space before the plus (+) sign',
+ \ 'type': 'E',
+ \ },
+ \ {
+ \ 'lnum': 200,
+ \ 'col': 1,
+ \ 'text': 'There should be a space before the plus (+) sign',
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#scala#scalastyle#Handle(347, [
+ \ 'Starting scalastyle',
+ \ 'start file /home/test/Doop.scala',
+ \ 'warning file=/home/test/Doop.scala message=Missing or badly formed ScalaDoc: Missing @param str line=190',
+ \ 'error file=/home/test/Doop.scala message=There should be a space before the plus (+) sign line=200 column=33',
+ \ 'error file=/home/test/Doop.scala message=There should be a space before the plus (+) sign line=200 column=0',
+ \ 'end file /home/test/Doop.scala',
+ \ 'Processed 1 file(s)',
+ \ 'Found 0 errors',
+ \ 'Found 3 warnings',
+ \ 'Finished in 934 ms',
+ \ ])
+
+After:
+ call ale#linter#Reset()