summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
Diffstat (limited to 'test')
-rw-r--r--test/command_callback/test_haskell_hlint_command_callbacks.vader16
-rw-r--r--test/command_callback/test_psalm_command_callbacks.vader12
-rw-r--r--test/command_callback/test_scss_stylelint_command_callback.vader31
-rw-r--r--test/handler/test_php_psalm_handler.vader24
4 files changed, 83 insertions, 0 deletions
diff --git a/test/command_callback/test_haskell_hlint_command_callbacks.vader b/test/command_callback/test_haskell_hlint_command_callbacks.vader
new file mode 100644
index 00000000..fb354ed4
--- /dev/null
+++ b/test/command_callback/test_haskell_hlint_command_callbacks.vader
@@ -0,0 +1,16 @@
+Before:
+ call ale#assert#SetUpLinterTest('haskell', 'hlint')
+ let b:base_opts = '--color=never --json -'
+
+After:
+ unlet! b:base_opts
+ call ale#assert#TearDownLinterTest()
+
+Execute(executable should be configurable):
+ AssertLinter 'hlint', ale#Escape('hlint') . ' ' . b:base_opts
+ let b:ale_haskell_hlint_executable = 'myHlint'
+ AssertLinter 'myHlint', ale#Escape('myHlint') . ' ' . b:base_opts
+
+Execute(should accept options):
+ let b:ale_haskell_hlint_options= '-h myhlintfile.yaml'
+ AssertLinter 'hlint', ale#Escape('hlint') . ' -h myhlintfile.yaml ' . b:base_opts
diff --git a/test/command_callback/test_psalm_command_callbacks.vader b/test/command_callback/test_psalm_command_callbacks.vader
new file mode 100644
index 00000000..4c31b7b4
--- /dev/null
+++ b/test/command_callback/test_psalm_command_callbacks.vader
@@ -0,0 +1,12 @@
+Before:
+ call ale#assert#SetUpLinterTest('php', 'psalm')
+
+After:
+ call ale#assert#TearDownLinterTest()
+
+Execute(Custom executables should be used for the executable and command):
+ let g:ale_php_psalm_executable = 'psalm_test'
+
+ AssertLinter 'psalm_test',
+ \ ale#Escape('psalm_test') . ' --diff --output-format=emacs %s'
+
diff --git a/test/command_callback/test_scss_stylelint_command_callback.vader b/test/command_callback/test_scss_stylelint_command_callback.vader
new file mode 100644
index 00000000..9c3a02d8
--- /dev/null
+++ b/test/command_callback/test_scss_stylelint_command_callback.vader
@@ -0,0 +1,31 @@
+Before:
+ call ale#assert#SetUpLinterTest('scss', 'stylelint')
+ unlet! b:executable
+
+After:
+ unlet! b:executable
+ call ale#assert#TearDownLinterTest()
+
+Execute(node_modules directories should be discovered):
+ call ale#test#SetFilename('stylelint_paths/nested/testfile.scss')
+
+ let b:executable = ale#path#Simplify(
+ \ g:dir
+ \ . '/stylelint_paths/node_modules/.bin/stylelint'
+ \)
+
+ AssertLinter b:executable, ale#Escape(b:executable) . ' --stdin-filename %s'
+
+Execute(The global override should work):
+ let b:ale_scss_stylelint_executable = 'foobar'
+ let b:ale_scss_stylelint_use_global = 1
+
+ call ale#test#SetFilename('stylelint_paths/nested/testfile.scss')
+
+ AssertLinter 'foobar', ale#Escape('foobar') . ' --stdin-filename %s'
+
+Execute(Extra options should be configurable):
+ let b:ale_scss_stylelint_options = '--configFile ''/absolute/path/to/file'''
+
+ AssertLinter 'stylelint',
+ \ ale#Escape('stylelint') . ' --configFile ''/absolute/path/to/file'' --stdin-filename %s'
diff --git a/test/handler/test_php_psalm_handler.vader b/test/handler/test_php_psalm_handler.vader
new file mode 100644
index 00000000..fd62a467
--- /dev/null
+++ b/test/handler/test_php_psalm_handler.vader
@@ -0,0 +1,24 @@
+Before:
+ runtime ale_linters/php/psalm.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The php static analyzer handler should parse errors from psalm):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'type': 'W',
+ \ 'text': 'somewarning',
+ \ },
+ \ {
+ \ 'lnum': 11,
+ \ 'type': 'E',
+ \ 'text': 'someerror',
+ \ },
+ \ ],
+ \ ale_linters#php#psalm#Handle(347, [
+ \ "/file:1:3:warning - somewarning",
+ \ "/file:11:33:error - someerror",
+ \ ])