summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_erlang_dialyzer_command_callback.vader37
-rw-r--r--test/handler/test_erlang_dialyzer_handler.vader27
2 files changed, 64 insertions, 0 deletions
diff --git a/test/command_callback/test_erlang_dialyzer_command_callback.vader b/test/command_callback/test_erlang_dialyzer_command_callback.vader
new file mode 100644
index 00000000..5e21c053
--- /dev/null
+++ b/test/command_callback/test_erlang_dialyzer_command_callback.vader
@@ -0,0 +1,37 @@
+Before:
+ call ale#assert#SetUpLinterTest('erlang', 'dialyzer')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(The default command should be correct.):
+ AssertLinter 'dialyzer',
+ \ ale#Escape('dialyzer')
+ \ . ' -n --plt ' . ale#Escape(expand('$HOME/.dialyzer_plt'))
+ \ . ' -Wunmatched_returns'
+ \ . ' -Werror_handling'
+ \ . ' -Wrace_conditions'
+ \ . ' -Wunderspecs'
+ \ . ' %s'
+
+Execute(The command should accept configured executable.):
+ let b:ale_erlang_dialyzer_executable = '/usr/bin/dialyzer'
+ AssertLinter '/usr/bin/dialyzer',
+ \ ale#Escape('/usr/bin/dialyzer')
+ \ . ' -n --plt ' . ale#Escape(expand('$HOME/.dialyzer_plt'))
+ \ . ' -Wunmatched_returns'
+ \ . ' -Werror_handling'
+ \ . ' -Wrace_conditions'
+ \ . ' -Wunderspecs'
+ \ . ' %s'
+
+Execute(The command should accept configured PLT file.):
+ let b:ale_erlang_dialyzer_plt_file = 'custom-plt'
+ AssertLinter 'dialyzer',
+ \ ale#Escape('dialyzer')
+ \ . ' -n --plt ' . ale#Escape(expand('custom-plt'))
+ \ . ' -Wunmatched_returns'
+ \ . ' -Werror_handling'
+ \ . ' -Wrace_conditions'
+ \ . ' -Wunderspecs'
+ \ . ' %s'
diff --git a/test/handler/test_erlang_dialyzer_handler.vader b/test/handler/test_erlang_dialyzer_handler.vader
new file mode 100644
index 00000000..afd5c597
--- /dev/null
+++ b/test/handler/test_erlang_dialyzer_handler.vader
@@ -0,0 +1,27 @@
+Before:
+ runtime ale_linters/erlang/dialyzer.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The dialyzer handler should handle error messages.):
+ AssertEqual
+ \[
+ \ {
+ \ 'lnum': 3,
+ \ 'lcol': 0,
+ \ 'text': 'Callback info about the provider behaviour is not available',
+ \ 'type': 'W'
+ \ }
+ \],
+ \ ale_linters#erlang#dialyzer#Handle(bufnr(''), ['erl_tidy_prv_fmt.erl:3: Callback info about the provider behaviour is not available'])
+
+Execute(The dialyzer handler should handle empty file.):
+ AssertEqual
+ \[],
+ \ ale_linters#erlang#dialyzer#Handle(bufnr(''), [])
+
+Execute(The dialyzer handler should handle empty lines.):
+ AssertEqual
+ \[],
+ \ ale_linters#erlang#dialyzer#Handle(bufnr(''), [''])