summaryrefslogtreecommitdiff
path: root/test/handler
diff options
context:
space:
mode:
Diffstat (limited to 'test/handler')
-rw-r--r--test/handler/test_ada_gcc_handler.vader36
-rw-r--r--test/handler/test_checkstyle_handler.vader13
-rw-r--r--test/handler/test_clang_handler.vader15
-rw-r--r--test/handler/test_credo_handler.vader26
-rw-r--r--test/handler/test_dockerfile_lint_handler.vader108
-rw-r--r--test/handler/test_eslint_handler.vader12
-rw-r--r--test/handler/test_flake8_handler.vader14
-rw-r--r--test/handler/test_gcc_handler.vader81
-rw-r--r--test/handler/test_gitlint_handler.vader19
-rw-r--r--test/handler/test_golangci_lint_handler.vader55
-rw-r--r--test/handler/test_haskell_stack_handler.vader7
-rw-r--r--test/handler/test_ispc_ispc_handler.vader90
-rw-r--r--test/handler/test_perl6_handler.vader277
-rw-r--r--test/handler/test_perl_handler.vader5
-rw-r--r--test/handler/test_pmd_handler.vader15
-rw-r--r--test/handler/test_rust_handler.vader145
-rw-r--r--test/handler/test_swipl_handler.vader95
-rw-r--r--test/handler/test_vulture_handler.vader92
18 files changed, 1089 insertions, 16 deletions
diff --git a/test/handler/test_ada_gcc_handler.vader b/test/handler/test_ada_gcc_handler.vader
new file mode 100644
index 00000000..06ddfe1f
--- /dev/null
+++ b/test/handler/test_ada_gcc_handler.vader
@@ -0,0 +1,36 @@
+Before:
+ runtime ale_linters/ada/gcc.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The gcc handler for Ada should parse input correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 8,
+ \ 'col': 5,
+ \ 'type': 'W',
+ \ 'text': 'variable "X" is assigned but never read',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 6,
+ \ 'col': 22,
+ \ 'type': 'E',
+ \ 'text': 'type definition expected',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 8,
+ \ 'col': 9,
+ \ 'type': 'E',
+ \ 'text': 'aspect specifications not allowed here',
+ \ },
+ \ ],
+ \ ale_linters#ada#gcc#Handle(0, [
+ \ 'foobar.adb:8:05: warning: variable "X" is assigned but never read',
+ \ 'foobar.ads:6:22: type definition expected',
+ \ 'foobar.ads:8:09: aspect specifications not allowed here',
+ \ ])
diff --git a/test/handler/test_checkstyle_handler.vader b/test/handler/test_checkstyle_handler.vader
index 2f1f0f8d..218fe344 100644
--- a/test/handler/test_checkstyle_handler.vader
+++ b/test/handler/test_checkstyle_handler.vader
@@ -26,3 +26,16 @@ Execute(The checkstyle handler should parse lines correctly):
\ '[WARN] whatever:101: ''method def rcurly'' has incorrect indentation level 4, expected level should be 2. [Indentation]',
\ '[WARN] whatever:63:3: Missing a Javadoc comment. [JavadocMethod]',
\ ])
+
+Execute(The checkstyle handler should parse lines from older checkstyle versions correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 289,
+ \ 'text': '''method def modifier'' have incorrect indentation level 4, expected level should be 2.',
+ \ 'type': 'W',
+ \ },
+ \ ],
+ \ ale_linters#java#checkstyle#Handle(666, [
+ \ '/home/languitar/src/rsb-java/rsb-java/src/main/java/rsb/Listener.java:289: warning: ''method def modifier'' have incorrect indentation level 4, expected level should be 2.',
+ \ ])
diff --git a/test/handler/test_clang_handler.vader b/test/handler/test_clang_handler.vader
index 278737a8..cc8eabd0 100644
--- a/test/handler/test_clang_handler.vader
+++ b/test/handler/test_clang_handler.vader
@@ -8,9 +8,20 @@ Execute(clang errors from included files should be parsed correctly):
\ 'type': 'E',
\ 'text': 'expected identifier or ''(''',
\ },
+ \ {
+ \ 'lnum': 3,
+ \ 'text': 'Error found in header. See :ALEDetail',
+ \ 'detail': join([
+ \ 'In file included from <stdin>:3:',
+ \ 'In file included from ./a.h:1:',
+ \ './b.h:1:1: error: expected identifier or ''(''',
+ \ '{{{',
+ \ '^',
+ \ ], "\n"),
+ \ },
\ ],
- \ ale#handlers#gcc#HandleGCCFormat(347, [
- \ 'In file included from test.c:3:',
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
+ \ 'In file included from <stdin>:3:',
\ 'In file included from ./a.h:1:',
\ './b.h:1:1: error: expected identifier or ''(''',
\ '{{{',
diff --git a/test/handler/test_credo_handler.vader b/test/handler/test_credo_handler.vader
index 5eb0e967..1fd54bb5 100644
--- a/test/handler/test_credo_handler.vader
+++ b/test/handler/test_credo_handler.vader
@@ -10,20 +10,44 @@ Execute(The credo handler should parse lines correctly):
\ {
\ 'bufnr': 347,
\ 'lnum': 1,
+ \ 'col': 24,
+ \ 'text': 'This code can be refactored',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'bufnr': 347,
+ \ 'lnum': 1,
\ 'col': 4,
\ 'text': 'There is no whitespace around parentheses/brackets most of the time, but here there is.',
- \ 'type': 'E',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'bufnr': 347,
+ \ 'lnum': 5,
+ \ 'col': 21,
+ \ 'text': 'TODO comment',
+ \ 'type': 'I',
\ },
\ {
\ 'bufnr': 347,
\ 'lnum': 26,
\ 'col': 0,
\ 'text': 'If/else blocks should not have a negated condition in `if`.',
+ \ 'type': 'I',
+ \ },
+ \ {
+ \ 'bufnr': 347,
+ \ 'lnum': 15,
+ \ 'col': 1,
+ \ 'text': 'Warning in the code',
\ 'type': 'W',
\ },
\ ],
\ ale_linters#elixir#credo#Handle(347, [
\ 'This line should be ignored completely',
+ \ 'lib/my_code/test.ex:1:24: F: This code can be refactored',
\ 'lib/filename.ex:1:4: C: There is no whitespace around parentheses/brackets most of the time, but here there is.',
+ \ 'lib/my_code/test.ex:5:21: D: TODO comment',
\ 'lib/phoenix/channel.ex:26: R: If/else blocks should not have a negated condition in `if`.',
+ \ 'lib/my_code/test.ex:15:1: W: Warning in the code',
\ ])
diff --git a/test/handler/test_dockerfile_lint_handler.vader b/test/handler/test_dockerfile_lint_handler.vader
new file mode 100644
index 00000000..619b7bde
--- /dev/null
+++ b/test/handler/test_dockerfile_lint_handler.vader
@@ -0,0 +1,108 @@
+Before:
+ runtime ale_linters/dockerfile/dockerfile_lint.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The dockerfile_lint handler should handle broken JSON):
+ AssertEqual
+ \ [],
+ \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), ["{asdf"])
+
+Execute(The dockerfile_lint handler should handle an empty string response):
+ AssertEqual
+ \ [],
+ \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), [])
+
+Execute(The dockerfile_lint handler should handle an empty result, even if it shouldn't happen):
+ AssertEqual
+ \ [],
+ \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), ["{}"])
+
+Execute(The dockerfile_lint handler should handle a normal example):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': -1,
+ \ 'type': 'E',
+ \ 'text': "Required LABEL name/key 'Name' is not defined",
+ \ },
+ \ {
+ \ 'lnum': -1,
+ \ 'type': 'E',
+ \ 'text': "Required LABEL name/key 'Version' is not defined",
+ \ },
+ \ {
+ \ 'lnum': 3,
+ \ 'type': 'I',
+ \ 'text': "the MAINTAINER command is deprecated. MAINTAINER is deprecated in favor of using LABEL since Docker v1.13.0",
+ \ },
+ \ {
+ \ 'lnum': -1,
+ \ 'type': 'I',
+ \ 'text': "There is no 'CMD' instruction",
+ \ },
+ \ ],
+ \ ale_linters#dockerfile#dockerfile_lint#Handle(bufnr(''), [
+ \ '{',
+ \ ' "error": {',
+ \ ' "count": 2,',
+ \ ' "data": [',
+ \ ' {',
+ \ " \"message\": \"Required LABEL name/key 'Name' is not defined\",",
+ \ ' "line": -1,',
+ \ ' "level": "error",',
+ \ ' "lineContent": "",',
+ \ ' "reference_url": [',
+ \ ' "http://docs.projectatomic.io/container-best-practices/#",',
+ \ ' "_recommended_labels_for_your_project"',
+ \ ' ]',
+ \ ' },',
+ \ ' {',
+ \ " \"message\": \"Required LABEL name/key 'Version' is not defined\",",
+ \ ' "line": -1,',
+ \ ' "level": "error",',
+ \ ' "lineContent": "",',
+ \ ' "reference_url": [',
+ \ ' "http://docs.projectatomic.io/container-best-practices/#",',
+ \ ' "_recommended_labels_for_your_project"',
+ \ ' ]',
+ \ ' }',
+ \ ' ]',
+ \ ' },',
+ \ ' "warn": {',
+ \ ' "count": 0,',
+ \ ' "data": []',
+ \ ' },',
+ \ ' "info": {',
+ \ ' "count": 2,',
+ \ ' "data": [',
+ \ ' {',
+ \ ' "label": "maintainer_deprecated",',
+ \ ' "regex": {},',
+ \ ' "level": "info",',
+ \ ' "message": "the MAINTAINER command is deprecated",',
+ \ ' "description": "MAINTAINER is deprecated in favor of using LABEL since Docker v1.13.0",',
+ \ ' "reference_url": [',
+ \ ' "https://github.com/docker/cli/blob/master/docs/deprecated.md",',
+ \ ' "#maintainer-in-dockerfile"',
+ \ ' ],',
+ \ ' "lineContent": "MAINTAINER Alexander Olofsson <ace@haxalot.com>",',
+ \ ' "line": 3',
+ \ ' },',
+ \ ' {',
+ \ ' "instruction": "CMD",',
+ \ ' "count": 1,',
+ \ ' "level": "info",',
+ \ " \"message\": \"There is no 'CMD' instruction\",",
+ \ ' "description": "None",',
+ \ ' "reference_url": [',
+ \ ' "https://docs.docker.com/engine/reference/builder/",',
+ \ ' "#cmd"',
+ \ ' ]',
+ \ ' }',
+ \ ' ]',
+ \ ' },',
+ \ ' "summary": []',
+ \ '}',
+ \ ])
diff --git a/test/handler/test_eslint_handler.vader b/test/handler/test_eslint_handler.vader
index 2e8bfd2a..4a57927b 100644
--- a/test/handler/test_eslint_handler.vader
+++ b/test/handler/test_eslint_handler.vader
@@ -365,3 +365,15 @@ Execute(eslint should handle react errors correctly):
\ ale#handlers#eslint#Handle(bufnr(''), [
\ '/path/editor-help.jsx:59:9: Property should be placed on the same line as the component declaration [Error/react/jsx-first-prop-new-line]',
\ ])
+
+Execute(Failing to connect to eslint_d should be handled correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'text': 'Could not connect to eslint_d. Try updating eslint_d or killing it.',
+ \ },
+ \ ],
+ \ ale#handlers#eslint#Handle(bufnr(''), [
+ \ 'Could not connect',
+ \ ])
diff --git a/test/handler/test_flake8_handler.vader b/test/handler/test_flake8_handler.vader
index efacdfb2..cdf20bc0 100644
--- a/test/handler/test_flake8_handler.vader
+++ b/test/handler/test_flake8_handler.vader
@@ -21,6 +21,7 @@ Execute(The flake8 handler should handle basic warnings and syntax errors):
\ {
\ 'lnum': 6,
\ 'col': 6,
+ \ 'vcol': 1,
\ 'type': 'E',
\ 'text': 'indentation is not a multiple of four',
\ 'code': 'E111',
@@ -29,6 +30,7 @@ Execute(The flake8 handler should handle basic warnings and syntax errors):
\ {
\ 'lnum': 7,
\ 'col': 6,
+ \ 'vcol': 1,
\ 'type': 'W',
\ 'text': 'some warning',
\ 'code': 'W123',
@@ -37,6 +39,7 @@ Execute(The flake8 handler should handle basic warnings and syntax errors):
\ {
\ 'lnum': 8,
\ 'col': 3,
+ \ 'vcol': 1,
\ 'type': 'E',
\ 'text': 'SyntaxError: invalid syntax',
\ 'code': 'E999',
@@ -54,6 +57,7 @@ Execute(The flake8 handler should set end column indexes for certain errors):
\ {
\ 'lnum': 25,
\ 'col': 1,
+ \ 'vcol': 1,
\ 'type': 'E',
\ 'end_col': 3,
\ 'text': 'undefined name ''foo''',
@@ -62,6 +66,7 @@ Execute(The flake8 handler should set end column indexes for certain errors):
\ {
\ 'lnum': 28,
\ 'col': 5,
+ \ 'vcol': 1,
\ 'type': 'E',
\ 'end_col': 9,
\ 'text': 'hello may be undefined, or defined from star imports: x',
@@ -70,6 +75,7 @@ Execute(The flake8 handler should set end column indexes for certain errors):
\ {
\ 'lnum': 104,
\ 'col': 5,
+ \ 'vcol': 1,
\ 'type': 'E',
\ 'end_col': 12,
\ 'text': '''continue'' not properly in loop',
@@ -78,6 +84,7 @@ Execute(The flake8 handler should set end column indexes for certain errors):
\ {
\ 'lnum': 106,
\ 'col': 5,
+ \ 'vcol': 1,
\ 'type': 'E',
\ 'end_col': 9,
\ 'text': '''break'' outside loop',
@@ -86,6 +93,7 @@ Execute(The flake8 handler should set end column indexes for certain errors):
\ {
\ 'lnum': 109,
\ 'col': 5,
+ \ 'vcol': 1,
\ 'type': 'E',
\ 'end_col': 8,
\ 'text': 'local variable ''test'' is assigned to but never used',
@@ -143,6 +151,7 @@ Execute(The flake8 handler should handle names with spaces):
\ {
\ 'lnum': 6,
\ 'col': 6,
+ \ 'vcol': 1,
\ 'type': 'E',
\ 'text': 'indentation is not a multiple of four',
\ 'code': 'E111',
@@ -159,6 +168,7 @@ Execute(Warnings about trailing whitespace should be reported by default):
\ {
\ 'lnum': 6,
\ 'col': 1,
+ \ 'vcol': 1,
\ 'code': 'W291',
\ 'type': 'W',
\ 'sub_type': 'style',
@@ -167,6 +177,7 @@ Execute(Warnings about trailing whitespace should be reported by default):
\ {
\ 'lnum': 6,
\ 'col': 1,
+ \ 'vcol': 1,
\ 'code': 'W293',
\ 'type': 'W',
\ 'sub_type': 'style',
@@ -195,6 +206,7 @@ Execute(Warnings about trailing blank lines should be reported by default):
\ {
\ 'lnum': 6,
\ 'col': 1,
+ \ 'vcol': 1,
\ 'code': 'W391',
\ 'type': 'W',
\ 'sub_type': 'style',
@@ -221,6 +233,7 @@ Execute(F401 should be a warning):
\ {
\ 'lnum': 6,
\ 'col': 1,
+ \ 'vcol': 1,
\ 'code': 'F401',
\ 'type': 'W',
\ 'text': 'module imported but unused',
@@ -236,6 +249,7 @@ Execute(E112 should be a syntax error):
\ {
\ 'lnum': 6,
\ 'col': 1,
+ \ 'vcol': 1,
\ 'code': 'E112',
\ 'type': 'E',
\ 'text': 'expected an indented block',
diff --git a/test/handler/test_gcc_handler.vader b/test/handler/test_gcc_handler.vader
index 678d3f42..3daa9e60 100644
--- a/test/handler/test_gcc_handler.vader
+++ b/test/handler/test_gcc_handler.vader
@@ -1,7 +1,7 @@
Execute(The GCC handler should ignore other lines of output):
AssertEqual
\ [],
- \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
\ 'foo',
\ 'bar',
\ 'baz',
@@ -17,12 +17,24 @@ Execute(GCC errors from included files should be parsed correctly):
\ 'type': 'E',
\ 'text': 'expected identifier or ''('' before ''{'' token',
\ },
+ \ {
+ \ 'lnum': 3,
+ \ 'col': 2,
+ \ 'text': 'Error found in header. See :ALEDetail',
+ \ 'detail': join([
+ \ 'In file included from <stdin>:3:2:',
+ \ 'broken.h:1:1: error: expected identifier or ''('' before ''{'' token',
+ \ ' {{{',
+ \ ' ^',
+ \ ], "\n"),
+ \ },
\ ],
- \ ale#handlers#gcc#HandleGCCFormat(347, [
- \ 'In file included from <stdin>:3:0:',
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
+ \ 'In file included from <stdin>:3:2:',
\ 'broken.h:1:1: error: expected identifier or ''('' before ''{'' token',
\ ' {{{',
\ ' ^',
+ \ 'compilation terminated.',
\ ])
AssertEqual
@@ -34,13 +46,25 @@ Execute(GCC errors from included files should be parsed correctly):
\ 'type': 'E',
\ 'text': 'expected identifier or ''('' before ''{'' token',
\ },
+ \ {
+ \ 'lnum': 5,
+ \ 'text': 'Error found in header. See :ALEDetail',
+ \ 'detail': join([
+ \ 'In file included from a.h:1:0,',
+ \ ' from <stdin>:5:',
+ \ 'b.h:1:1: error: expected identifier or ''('' before ''{'' token',
+ \ ' {{{',
+ \ ' ^',
+ \ ], "\n"),
+ \ },
\ ],
- \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
\ 'In file included from a.h:1:0,',
- \ ' from test.c:3:',
+ \ ' from <stdin>:5:',
\ 'b.h:1:1: error: expected identifier or ''('' before ''{'' token',
\ ' {{{',
\ ' ^',
+ \ 'compilation terminated.',
\ ])
AssertEqual
@@ -59,16 +83,31 @@ Execute(GCC errors from included files should be parsed correctly):
\ 'type': 'E',
\ 'text': 'unknown type name ''other_bad_type''',
\ },
+ \ {
+ \ 'lnum': 3,
+ \ 'text': 'Error found in header. See :ALEDetail',
+ \ 'detail': join([
+ \ 'In file included from a.h:1:0,',
+ \ ' from <stdin>:3:',
+ \ 'b.h:1:1: error: unknown type name ‘bad_type’',
+ \ ' bad_type x;',
+ \ ' ^',
+ \ 'b.h:2:1: error: unknown type name ‘other_bad_type’',
+ \ ' other_bad_type y;',
+ \ ' ^',
+ \ ], "\n"),
+ \ },
\ ],
- \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
\ 'In file included from a.h:1:0,',
- \ ' from test.c:3:',
+ \ ' from <stdin>:3:',
\ 'b.h:1:1: error: unknown type name ‘bad_type’',
\ ' bad_type x;',
\ ' ^',
\ 'b.h:2:1: error: unknown type name ‘other_bad_type’',
\ ' other_bad_type y;',
\ ' ^',
+ \ 'compilation terminated.',
\ ])
Execute(The GCC handler shouldn't complain about #pragma once for headers):
@@ -76,7 +115,7 @@ Execute(The GCC handler shouldn't complain about #pragma once for headers):
AssertEqual
\ [],
- \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
\ '<stdin>:1:1: warning: #pragma once in main file [enabled by default]',
\ ])
@@ -84,7 +123,7 @@ Execute(The GCC handler shouldn't complain about #pragma once for headers):
AssertEqual
\ [],
- \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
\ '<stdin>:1:1: warning: #pragma once in main file [enabled by default]',
\ ])
@@ -119,7 +158,7 @@ Execute(The GCC handler should handle syntax errors):
\ 'text': 'expected '';'' before ''o'''
\ },
\ ],
- \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
\ '<stdin>:6:12: error: invalid suffix "p" on integer constant',
\ '<stdin>:17:5: error: invalid suffix "n" on integer constant',
\ '<stdin>:4: error: variable or field ''foo'' declared void',
@@ -130,11 +169,27 @@ Execute(The GCC handler should handle syntax errors):
Execute(The GCC handler should handle notes with no previous message):
AssertEqual
\ [],
- \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
\ '<stdin>:1:1: note: x',
\ '<stdin>:1:1: note: x',
\ ])
+Execute(The GCC handler should attach notes to previous messages):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 6,
+ \ 'col': 12,
+ \ 'type': 'E',
+ \ 'text': 'Some error',
+ \ 'detail': "Some error\n<stdin>:1:1: note: x",
+ \ },
+ \ ],
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
+ \ '-:6:12: error: Some error',
+ \ '<stdin>:1:1: note: x',
+ \ ])
+
Execute(The GCC handler should interpret - as being the current file):
AssertEqual
\ [
@@ -145,7 +200,7 @@ Execute(The GCC handler should interpret - as being the current file):
\ 'text': 'Some error',
\ },
\ ],
- \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
\ '-:6:12: error: Some error',
\ ])
@@ -159,6 +214,6 @@ Execute(The GCC handler should handle fatal error messages due to missing files)
\ 'text': 'foo.h: No such file or directory'
\ },
\ ],
- \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
\ '<stdin>:3:12: fatal error: foo.h: No such file or directory',
\ ])
diff --git a/test/handler/test_gitlint_handler.vader b/test/handler/test_gitlint_handler.vader
index 60d632a0..5c531664 100644
--- a/test/handler/test_gitlint_handler.vader
+++ b/test/handler/test_gitlint_handler.vader
@@ -61,6 +61,19 @@ Execute(Disabling trailing whitespace warnings should work):
\ '8: T2 Trailing whitespace',
\])
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 8,
+ \ 'type': 'E',
+ \ 'text': 'Trailing whitespace',
+ \ 'code': 'B2',
+ \ },
+ \ ],
+ \ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
+ \ '8: B2 Trailing whitespace',
+ \])
+
let b:ale_warn_about_trailing_whitespace = 0
AssertEqual
@@ -68,3 +81,9 @@ Execute(Disabling trailing whitespace warnings should work):
\ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
\ '8: T2 Trailing whitespace',
\ ])
+
+ AssertEqual
+ \ [],
+ \ ale_linters#gitcommit#gitlint#Handle(bufnr(''), [
+ \ '8: B2 Trailing whitespace',
+ \ ])
diff --git a/test/handler/test_golangci_lint_handler.vader b/test/handler/test_golangci_lint_handler.vader
new file mode 100644
index 00000000..fb6841f4
--- /dev/null
+++ b/test/handler/test_golangci_lint_handler.vader
@@ -0,0 +1,55 @@
+Before:
+ runtime ale_linters/go/golangci_lint.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute (The golangci-lint handler should handle names with spaces):
+ " We can't test Windows paths with the path resovling on Linux, but we can
+ " test the regex.
+ AssertEqual
+ \ [
+ \ [
+ \ 'C:\something\file with spaces.go',
+ \ '12',
+ \ '3',
+ \ 'expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ ],
+ \ [
+ \ 'C:\something\file with spaces.go',
+ \ '37',
+ \ '5',
+ \ 'expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ ],
+ \ ],
+ \ map(ale_linters#go#golangci_lint#GetMatches([
+ \ 'C:\something\file with spaces.go:12:3: expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ 'C:\something\file with spaces.go:37:5: expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ ]), 'v:val[1:4]')
+
+Execute (The golangci-lint handler should handle paths correctly):
+ call ale#test#SetFilename('app/test.go')
+
+ let file = ale#path#GetAbsPath(expand('%:p:h'), 'test.go')
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 12,
+ \ 'col': 3,
+ \ 'text': 'expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ 'type': 'E',
+ \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'),
+ \ },
+ \ {
+ \ 'lnum': 37,
+ \ 'col': 5,
+ \ 'text': 'expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ 'type': 'E',
+ \ 'filename': ale#path#Simplify(expand('%:p:h') . '/test.go'),
+ \ },
+ \ ],
+ \ ale_linters#go#golangci_lint#Handler(bufnr(''), [
+ \ file . ':12:3: expected ''package'', found ''IDENT'' gibberish (staticcheck)',
+ \ file . ':37:5: expected ''package'', found ''IDENT'' gibberish (golint)',
+ \ ])
diff --git a/test/handler/test_haskell_stack_handler.vader b/test/handler/test_haskell_stack_handler.vader
new file mode 100644
index 00000000..07e7e69c
--- /dev/null
+++ b/test/handler/test_haskell_stack_handler.vader
@@ -0,0 +1,7 @@
+Before:
+ runtime ale/handlers/haskell_stack.vim
+
+Execute(Escape stack should correctly identify a stack exec command):
+ AssertEqual
+ \ ale#Escape('stack') . ' exec ' . ale#Escape('hlint') . ' --',
+ \ ale#handlers#haskell_stack#EscapeExecutable('stack', 'hlint')
diff --git a/test/handler/test_ispc_ispc_handler.vader b/test/handler/test_ispc_ispc_handler.vader
new file mode 100644
index 00000000..619773fe
--- /dev/null
+++ b/test/handler/test_ispc_ispc_handler.vader
@@ -0,0 +1,90 @@
+Before:
+ runtime ale_linters/ispc/ispc.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The ispc handler should parse input correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 33,
+ \ 'col': 14,
+ \ 'type': 'E',
+ \ 'text': 'syntax error, unexpected ''int'', expecting '','' or '';''.',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 36,
+ \ 'col': 5,
+ \ 'type': 'E',
+ \ 'text': 'syntax error, unexpected ''for''.',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 51,
+ \ 'col': 9,
+ \ 'type': 'E',
+ \ 'text': '''foobar.h'' file not found',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 79,
+ \ 'col': 52,
+ \ 'type': 'W',
+ \ 'text': 'Modulus operator with varying types is very inefficient.',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 85,
+ \ 'col': 13,
+ \ 'type': 'W',
+ \ 'text': 'Undefined behavior: all program instances are writing to the same location!',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 93,
+ \ 'col': 19,
+ \ 'type': 'W',
+ \ 'text': 'Gather required to load value.',
+ \ },
+ \ {
+ \ 'bufnr': 0,
+ \ 'lnum': 93,
+ \ 'col': 9,
+ \ 'type': 'W',
+ \ 'text': 'Scatter required to store value.',
+ \ },
+ \ ],
+ \ ale_linters#ispc#ispc#Handle(0, [
+ \ 'Warning: No output file or header file name specified. Program will be compiled and warnings/errors will be issued, but no output will be generated. ',
+ \ 'Warning: No --target specified on command-line. Using default system target "avx2-i32x8".',
+ \ 'mandelbrot.ispc:33:14: Error: syntax error, unexpected ''int'', expecting '','' or '';''.',
+ \ 'static iline int mandel(float c_re, float c_im, int count) {',
+ \ ' ^^^',
+ \ '',
+ \ 'mandelbrot.ispc:36:5: Error: syntax error, unexpected ''for''.',
+ \ ' for (i = 0; i < count; ++i) {',
+ \ ' ^^^',
+ \ '',
+ \ 'mandelbrot.ispc:51:9: fatal error: ''foobar.h'' file not found',
+ \ '#include<foobar.h>',
+ \ ' ^~~~~~~~~~',
+ \ 'mandelbrot.ispc:79:52: Performance Warning: Modulus operator with varying types is very inefficient.',
+ \ ' double x = x0 + i * (dx + epsilon*(k%2)*delta);',
+ \ ' ^^^',
+ \ '',
+ \ 'mandelbrot.ispc:85:13: Warning: Undefined behavior: all program instances are writing to the same location!',
+ \ ' output[index] = (NNN) / sample_size;',
+ \ ' ^^^^^^^^^^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:93:19: Performance Warning: Gather required to load value.',
+ \ ' A[i*8] *= A[i*8];',
+ \ ' ^^^^^^',
+ \ '',
+ \ 'mandelbrot.ispc:93:9: Performance Warning: Scatter required to store value.',
+ \ ' A[i*8] *= A[i*8];',
+ \ ' ^^^^^^',
+ \ '',
+ \ ])
diff --git a/test/handler/test_perl6_handler.vader b/test/handler/test_perl6_handler.vader
new file mode 100644
index 00000000..452a9174
--- /dev/null
+++ b/test/handler/test_perl6_handler.vader
@@ -0,0 +1,277 @@
+Before:
+ call ale#test#SetDirectory('/testplugin/test/handler')
+
+ runtime ale_linters/perl6/perl6.vim
+
+After:
+ call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
+
+Execute(The Perl6 linter should handle empty output):
+ call ale#test#SetFilename('bar.pl6')
+
+ AssertEqual [], ale_linters#perl6#perl6#Handle(bufnr(''), [])
+
+Execute(The Perl6 linter should complain about undeclared variables):
+ call ale#test#SetFilename('bar.pl6')
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': '6',
+ \ 'text': 'Variable ''$tes'' is not declared. Did you mean any of these? $res $test ',
+ \ 'type': 'E',
+ \ 'col': '',
+ \ 'end_lnum': '',
+ \ 'code': 'X::Undeclared',
+ \ }
+ \ ],
+ \ ale_linters#perl6#perl6#Handle(bufnr(''), [
+ \ '{
+ \ "X::Undeclared" : {
+ \ "highexpect" : [ ],
+ \ "is-compile-time" : 1,
+ \ "modules" : [ ],
+ \ "column" : null,
+ \ "pos" : 18,
+ \ "symbol" : "$tes",
+ \ "filename" : "bar.pl6",
+ \ "what" : "Variable",
+ \ "pre" : "my $test = 0; say ",
+ \ "post" : "$tes",
+ \ "suggestions" : [
+ \ "$res",
+ \ "$test"
+ \ ],
+ \ "line" : 6,
+ \ "message" : "Variable ''$tes'' is not declared. Did you mean any of these?\n $res\n $test\n"
+ \ }
+ \ }'
+ \ ])
+
+Execute(The Perl6 linter should complain about Comp::AdHoc errors):
+ call ale#test#SetFilename('bar.pl6')
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': '3',
+ \ 'type': 'E',
+ \ 'text': 'is repr(...) trait needs a parameter',
+ \ 'col': '',
+ \ 'end_lnum': '',
+ \ 'code': 'X::Comp::AdHoc',
+ \ }
+ \ ],
+ \ ale_linters#perl6#perl6#Handle(bufnr(''), [
+ \ '{
+ \ "X::Comp::AdHoc" : {
+ \ "pre" : "class test is repr",
+ \ "message" : "is repr(...) trait needs a parameter",
+ \ "line" : 3,
+ \ "post" : " {}",
+ \ "is-compile-time" : true,
+ \ "pos" : 19,
+ \ "highexpect" : [ ],
+ \ "payload" : "is repr(...) trait needs a parameter",
+ \ "filename" : "bar.pl6",
+ \ "column" : null,
+ \ "modules" : [ ]
+ \ }
+ \ }'
+ \])
+
+Execute(The Perl6 linter should be able to extract a line number from an error message):
+ call ale#test#SetFilename('bar.pl6')
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': '3',
+ \ 'text': 'Could not find Module::Does::not::exist at line 3 in: /usr/share/perl6/site /usr/share/perl6/vendor /usr/share/perl6 CompUnit::Repository::AbsolutePath<94023691448416> CompUnit::Repository::NQP<94023670532736> CompUnit::Repository::Perl5<94023670532776>',
+ \ 'col': '',
+ \ 'type': 'E',
+ \ 'end_lnum': '',
+ \ 'code': 'X::CompUnit::UnsatisfiedDependency',
+ \ }
+ \ ],
+ \ ale_linters#perl6#perl6#Handle(bufnr(''), [
+ \ '{
+ \ "X::CompUnit::UnsatisfiedDependency" : {
+ \ "message" : "Could not find Module::Does::not::exist at line 3 in:\n /usr/share/perl6/site\n /usr/share/perl6/vendor\n /usr/share/perl6\n CompUnit::Repository::AbsolutePath<94023691448416>\n CompUnit::Repository::NQP<94023670532736>\n CompUnit::Repository::Perl5<94023670532776>",
+ \ "specification" : "Module::Does::not::exist"
+ \ }
+ \ }'
+ \ ])
+
+Execute(The Perl6 linter should be able to differentiate between warnings and errors):
+ call ale#test#SetFilename('bar.pl6')
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': '1',
+ \ 'col': '',
+ \ 'code': 'X::Syntax::Regex::Unterminated',
+ \ 'end_lnum': '',
+ \ 'type': 'E',
+ \ 'text': 'Regex not terminated.',
+ \ },
+ \ {
+ \ 'lnum': '1',
+ \ 'col': '',
+ \ 'code': 'X::Comp::AdHoc',
+ \ 'end_lnum': '',
+ \ 'type': 'W',
+ \ 'text': 'Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing)',
+ \ }
+ \ ],
+ \ ale_linters#perl6#perl6#Handle(bufnr(''), [
+ \ '{
+ \ "X::Comp::Group" : {
+ \ "message" : "Regex not terminated.\nUnable to parse regex; couldn''t find final ''/''\nSpace is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing)",
+ \ "panic" : "Unable to parse regex; couldn''t find final ''/''",
+ \ "sorrows" : [
+ \ {
+ \ "X::Syntax::Regex::Unterminated" : {
+ \ "highexpect" : [
+ \ "infix stopper"
+ \ ],
+ \ "pos" : 6,
+ \ "is-compile-time" : 1,
+ \ "modules" : [ ],
+ \ "post" : "<EOL>",
+ \ "message" : "Regex not terminated.",
+ \ "line" : 1,
+ \ "filename" : "bar.pl6",
+ \ "column" : null,
+ \ "pre" : "/win 3"
+ \ }
+ \ }
+ \ ],
+ \ "worries" : [
+ \ {
+ \ "X::Comp::AdHoc" : {
+ \ "filename" : "bar.pl6",
+ \ "line" : 1,
+ \ "column" : null,
+ \ "pre" : "/win",
+ \ "highexpect" : [ ],
+ \ "payload" : "Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing)",
+ \ "post" : " 3",
+ \ "message" : "Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing)",
+ \ "modules" : [ ],
+ \ "is-compile-time" : true,
+ \ "pos" : 4
+ \ }
+ \ }
+ \ ]
+ \ }
+ \ }'
+ \])
+
+Execute(The Perl6 linter should gracefully handle non-JSON messages):
+ call ale#test#SetFilename('bar.pl6')
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': '1',
+ \ 'text': 'Received output in the default Perl6 error format. See :ALEDetail for details',
+ \ 'type': 'W',
+ \ 'detail': join([
+ \ 'Potential difficulties:',
+ \ ' Redeclaration of symbol ''$_''',
+ \ ' at /home/travis/perl6-error-fail/insanity-test.pl6:1',
+ \ ' ------> sub foo($_) {.say}; my $_<HERE> = 1; .&foo;',
+ \ ' Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing)',
+ \ ' at /home/travis/perl6-error-fail/insanity-test.pl6:4',
+ \ ' ------> /win<HERE> 3/',
+ \ 'Syntax OK',], "\n")
+ \ }
+ \ ],
+ \ ale_linters#perl6#perl6#Handle(bufnr(''), [
+ \ 'Potential difficulties:',
+ \ ' Redeclaration of symbol ''$_''',
+ \ ' at /home/travis/perl6-error-fail/insanity-test.pl6:1',
+ \ ' ------> sub foo($_) {.say}; my $_<HERE> = 1; .&foo;',
+ \ ' Space is not significant here; please use quotes or :s (:sigspace) modifier (or, to suppress this warning, omit the space, or otherwise change the spacing)',
+ \ ' at /home/travis/perl6-error-fail/insanity-test.pl6:4',
+ \ ' ------> /win<HERE> 3/',
+ \ 'Syntax OK'
+ \ ])
+
+Execute(The Perl6 linter should gracefully handle messages without a line number):
+ call ale#test#SetFilename('bar.pl6')
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': '1',
+ \ 'end_lnum': '',
+ \ 'text': 'Cannot find method ''has_compile_time_value'' on object of type NQPMu',
+ \ 'type': 'E',
+ \ 'col' : '',
+ \ 'code': 'X::AdHoc',
+ \ }
+ \ ],
+ \ ale_linters#perl6#perl6#Handle(bufnr(''), [
+ \ '{',
+ \ '"X::AdHoc" : {',
+ \ '"message" : "Cannot find method ''has_compile_time_value'' on object of type NQPMu",',
+ \ '"payload" : "Cannot find method ''has_compile_time_value'' on object of type NQPMu"',
+ \ '}',
+ \ '}',
+ \ ])
+
+Execute(The Perl6 linter should not include errors from a known separate file):
+ call ale#test#SetFilename('bar.pl6')
+
+ AssertEqual
+ \ [],
+ \ ale_linters#perl6#perl6#Handle(bufnr(''), [
+ \ '{
+ \ "X::Undeclared" : {
+ \ "highexpect" : [ ],
+ \ "is-compile-time" : 1,
+ \ "modules" : [ ],
+ \ "column" : null,
+ \ "pos" : 18,
+ \ "symbol" : "$tes",
+ \ "filename" : "foo.pl6",
+ \ "what" : "Variable",
+ \ "pre" : "my $test = 0; say ",
+ \ "post" : "$tes",
+ \ "suggestions" : [
+ \ "$res",
+ \ "$test"
+ \ ],
+ \ "line" : 6,
+ \ "message" : "Variable ''$tes'' is not declared. Did you mean any of these?\n $res\n $test\n"
+ \ }
+ \ }'
+ \ ])
+
+Execute(The Perl6 linter should not ignore errors without a filename):
+ call ale#test#SetFilename('bar.pl6')
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': '3',
+ \ 'end_lnum': '',
+ \ 'text': 'Cannot find method ''has_compile_time_value'' on object of type NQPMu',
+ \ 'type': 'E',
+ \ 'col' : '',
+ \ 'code': 'X::AdHoc',
+ \ }
+ \ ],
+ \ ale_linters#perl6#perl6#Handle(bufnr(''), [
+ \ '{',
+ \ '"X::AdHoc" : {',
+ \ '"line" : 3,',
+ \ '"message" : "Cannot find method ''has_compile_time_value'' on object of type NQPMu",',
+ \ '"payload" : "Cannot find method ''has_compile_time_value'' on object of type NQPMu"',
+ \ '}',
+ \ '}',
+ \ ])
diff --git a/test/handler/test_perl_handler.vader b/test/handler/test_perl_handler.vader
index c5791d76..e769550c 100644
--- a/test/handler/test_perl_handler.vader
+++ b/test/handler/test_perl_handler.vader
@@ -7,6 +7,11 @@ After:
call ale#test#RestoreDirectory()
call ale#linter#Reset()
+Execute(The Perl linter should handle empty output):
+ call ale#test#SetFilename('bar.pl')
+
+ AssertEqual [], ale_linters#perl#perl#Handle(bufnr(''), [])
+
Execute(The Perl linter should ignore errors from other files):
call ale#test#SetFilename('bar.pl')
diff --git a/test/handler/test_pmd_handler.vader b/test/handler/test_pmd_handler.vader
index 0c95fb2a..4f64c9ca 100644
--- a/test/handler/test_pmd_handler.vader
+++ b/test/handler/test_pmd_handler.vader
@@ -25,3 +25,18 @@ Execute(The pmd handler should parse lines correctly):
\ '"1","rsb.performance.test.ros","/home/languitar/src/rsb-performance-test-api-ros/src/main/java/rsb/performance/test/ros/NodeHolder.java","3","18","Each class should declare at least one constructor","Code Style","AtLeastOneConstructor"',
\ '"2","rsb.performance.test.ros","/home/languitar/src/rsb-performance-test-api-ros/src/main/java/rsb/performance/test/ros/NodeHolder.java","1","36","Local variable ''node'' could be declared final","Code Style","LocalVariableCouldBeFinal"'
\ ])
+
+Execute(The pmd handler should parse lines correctly for java files that use unnamed packages):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 8,
+ \ 'text': 'Avoid unused local variables such as ''stest''.',
+ \ 'code': 'Best Practices - UnusedLocalVariable',
+ \ 'type': 'W',
+ \ },
+ \ ],
+ \ ale_linters#java#pmd#Handle(666, [
+ \ '"Problem","Package","File","Priority","Line","Description","Rule set","Rule"',
+ \ '"1","","/Users/diego/Projects/github.com/dlresende/kata-fizz-buzz/src/main/java/App.java","3","8","Avoid unused local variables such as ''stest''.","Best Practices","UnusedLocalVariable"'
+ \ ])
diff --git a/test/handler/test_rust_handler.vader b/test/handler/test_rust_handler.vader
index e3ab3e86..4764e713 100644
--- a/test/handler/test_rust_handler.vader
+++ b/test/handler/test_rust_handler.vader
@@ -285,3 +285,148 @@ Execute(The Rust handler should find correct files):
\ },
\ }),
\ ])
+
+Execute(The Rust handler should remove secondary spans if set):
+ call ale#test#SetFilename('src/noerrors/mod.rs')
+
+ let g:ale_rust_ignore_secondary_spans = 0
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'end_lnum': 1,
+ \ 'type': 'E',
+ \ 'end_col': 21,
+ \ 'col': 1,
+ \ 'text': 'this function takes 1 parameter but 0 were supplied: defined here',
+ \ },
+ \ {
+ \ 'lnum': 1,
+ \ 'end_lnum': 1,
+ \ 'type': 'E',
+ \ 'end_col': 46,
+ \ 'col': 40,
+ \ 'text': 'this function takes 1 parameter but 0 were supplied: expected 1 parameter',
+ \ },
+ \ ],
+ \ ale#handlers#rust#HandleRustErrors(bufnr(''), [
+ \ '',
+ \ 'fn test(x: u8) -> u8 { x } fn main() { x(); }',
+ \ json_encode({
+ \ 'message': {
+ \ 'code': {
+ \ 'code': 'E0061',
+ \ 'explanation': 'Dummy explanation; not used'
+ \ },
+ \ 'level': 'error',
+ \ 'message': 'this function takes 1 parameter but 0 were supplied',
+ \ 'spans': [
+ \ {
+ \ 'byte_end': 20,
+ \ 'byte_start': 0,
+ \ 'column_end': 21,
+ \ 'column_start': 1,
+ \ 'file_name': 'src/noerrors/mod.rs',
+ \ 'is_primary': v:false,
+ \ 'label': 'defined here',
+ \ 'line_end': 1,
+ \ 'line_start': 1,
+ \ },
+ \ {
+ \ 'byte_end': 45,
+ \ 'byte_start': 39,
+ \ 'column_end': 46,
+ \ 'column_start': 40,
+ \ 'file_name': '<anon>',
+ \ 'is_primary': v:true,
+ \ 'label': 'expected 1 parameter',
+ \ 'line_end': 1,
+ \ 'line_start': 1,
+ \ },
+ \ ]
+ \ },
+ \ }),
+ \ json_encode({
+ \ 'message': {
+ \ 'code': v:null,
+ \ 'level': 'error',
+ \ 'message': 'aborting due to previous error',
+ \ 'spans': []
+ \ },
+ \ }),
+ \ json_encode({
+ \ 'message': {
+ \ 'code': v:null,
+ \ 'level': 'error',
+ \ 'message': 'For more information about this error, try `rustc --explain E0061`.',
+ \ 'spans': []
+ \ },
+ \ }),
+ \ ])
+
+ let g:ale_rust_ignore_secondary_spans = 1
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'end_lnum': 1,
+ \ 'type': 'E',
+ \ 'end_col': 46,
+ \ 'col': 40,
+ \ 'text': 'this function takes 1 parameter but 0 were supplied: expected 1 parameter',
+ \ },
+ \ ],
+ \ ale#handlers#rust#HandleRustErrors(bufnr(''), [
+ \ '',
+ \ 'fn test(x: u8) -> u8 { x } fn main() { x(); }',
+ \ json_encode({
+ \ 'message': {
+ \ 'code': {
+ \ 'code': 'E0061',
+ \ 'explanation': 'Dummy explanation; not used'
+ \ },
+ \ 'level': 'error',
+ \ 'message': 'this function takes 1 parameter but 0 were supplied',
+ \ 'spans': [
+ \ {
+ \ 'byte_end': 20,
+ \ 'byte_start': 0,
+ \ 'column_end': 21,
+ \ 'column_start': 1,
+ \ 'file_name': 'src/noerrors/mod.rs',
+ \ 'is_primary': v:false,
+ \ 'label': 'defined here',
+ \ 'line_end': 1,
+ \ 'line_start': 1,
+ \ },
+ \ {
+ \ 'byte_end': 45,
+ \ 'byte_start': 39,
+ \ 'column_end': 46,
+ \ 'column_start': 40,
+ \ 'file_name': '<anon>',
+ \ 'is_primary': v:true,
+ \ 'label': 'expected 1 parameter',
+ \ 'line_end': 1,
+ \ 'line_start': 1,
+ \ },
+ \ ]
+ \ },
+ \ }),
+ \ json_encode({
+ \ 'message': {
+ \ 'code': v:null,
+ \ 'level': 'error',
+ \ 'message': 'aborting due to previous error',
+ \ 'spans': []
+ \ },
+ \ }),
+ \ json_encode({
+ \ 'message': {
+ \ 'code': v:null,
+ \ 'level': 'error',
+ \ 'message': 'For more information about this error, try `rustc --explain E0061`.',
+ \ 'spans': []
+ \ },
+ \ }),
+ \ ])
diff --git a/test/handler/test_swipl_handler.vader b/test/handler/test_swipl_handler.vader
new file mode 100644
index 00000000..9e425cf6
--- /dev/null
+++ b/test/handler/test_swipl_handler.vader
@@ -0,0 +1,95 @@
+Before:
+ runtime ale_linters/prolog/swipl.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute (The swipl handler should handle oneline warning / error):
+ call ale#test#SetFilename('test.pl')
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 5,
+ \ 'col': 1,
+ \ 'text': 'Syntax error: Operator expected',
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#prolog#swipl#Handle(bufnr(''), [
+ \ 'ERROR: /path/to/test.pl:5:1: Syntax error: Operator expected',
+ \ ])
+
+Execute (The swipl handler should handle a warning / error of two lines):
+ call ale#test#SetFilename('test.pl')
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 9,
+ \ 'col': 0,
+ \ 'text': 'Singleton variables: [M]',
+ \ 'type': 'W',
+ \ },
+ \ ],
+ \ ale_linters#prolog#swipl#Handle(bufnr(''), [
+ \ 'Warning: /path/to/test.pl:9:',
+ \ ' Singleton variables: [M]',
+ \ ])
+
+Execute (The swipl handler should join three or more lines with '. '):
+ call ale#test#SetFilename('test.pl')
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 10,
+ \ 'col': 0,
+ \ 'text': 'Clauses of fib/2 are not together in the source-file. Earlier definition at /path/to/test.pl:7. Current predicate: f/0. Use :- discontiguous fib/2. to suppress this message',
+ \ 'type': 'W',
+ \ },
+ \ ],
+ \ ale_linters#prolog#swipl#Handle(bufnr(''), [
+ \ 'Warning: /path/to/test.pl:10:',
+ \ ' Clauses of fib/2 are not together in the source-file',
+ \ ' Earlier definition at /path/to/test.pl:7',
+ \ ' Current predicate: f/0',
+ \ ' Use :- discontiguous fib/2. to suppress this message',
+ \ ])
+
+Execute (The swipl handler should ignore warnings / errors 'No permission to call sandboxed ...'):
+ call ale#test#SetFilename('test.pl')
+ AssertEqual
+ \ [],
+ \ ale_linters#prolog#swipl#Handle(bufnr(''), [
+ \ 'ERROR: /path/to/test.pl:11:',
+ \ ' No permission to call sandboxed `''$set_predicate_attribute''(_G3416:_G3417,_G3413,_G3414)''',
+ \ ' Reachable from:',
+ \ ' system:''$set_pattr''(A,B,C,D)',
+ \ ' system:''$set_pattr''(vimscript:A,B,C)',
+ \ ' vimscript: (multifile A)',
+ \ 'ERROR: /path/to/test.pl:12:',
+ \ ' No permission to call sandboxed `''$set_predicate_attribute''(_G205:_G206,_G202,_G203)''',
+ \ ' Reachable from:',
+ \ ' system:''$set_pattr''(A,B,C,D)',
+ \ ' system:''$set_pattr''(vimscript:A,B,C)',
+ \ ' vimscript: (multifile A)',
+ \ 'ERROR: /path/to/test.pl:13:',
+ \ ' No permission to call sandboxed `''$set_predicate_attribute''(_G1808:_G1809,_G1805,_G1806)''',
+ \ ' Reachable from:',
+ \ ' system:''$set_pattr''(A,B,C,D)',
+ \ ' system:''$set_pattr''(vimscript:A,B,C)',
+ \ ' vimscript: (multifile A)',
+ \ ])
+
+Execute (The swipl handler should handle a warning / error with no line number):
+ call ale#test#SetFilename('test.pl')
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 0,
+ \ 'text': 'Exported procedure module_name:pred/0 is not defined',
+ \ 'type': 'E',
+ \ },
+ \ ],
+ \ ale_linters#prolog#swipl#Handle(bufnr(''), [
+ \ 'ERROR: Exported procedure module_name:pred/0 is not defined',
+ \ ])
diff --git a/test/handler/test_vulture_handler.vader b/test/handler/test_vulture_handler.vader
new file mode 100644
index 00000000..c6bd7643
--- /dev/null
+++ b/test/handler/test_vulture_handler.vader
@@ -0,0 +1,92 @@
+Before:
+ runtime ale_linters/python/vulture.vim
+
+ call ale#test#SetDirectory('/testplugin/test/handler')
+
+After:
+ Restore
+
+ call ale#test#RestoreDirectory()
+ call ale#linter#Reset()
+
+ silent file something_else.py
+
+Execute(Basic vulture check with relative path in result should be handled):
+ call ale#test#SetFilename('something_else.py')
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 34,
+ \ 'text': 'unused variable ''foo'' (60% confidence)',
+ \ 'type': 'W',
+ \ 'filename': ale#path#Simplify(g:dir . '/something_else.py'),
+ \ },
+ \ ],
+ \ ale_linters#python#vulture#Handle(bufnr(''), [
+ \ './something_else.py:34: unused variable ''foo'' (60% confidence)',
+ \ ])
+
+Execute(Basic vulture check with absolute path in result should be handled):
+ call ale#test#SetFilename('something_else.py')
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 34,
+ \ 'text': 'unused variable ''foo'' (60% confidence)',
+ \ 'type': 'W',
+ \ 'filename': ale#path#Simplify(g:dir . '/something_else.py'),
+ \ },
+ \ ],
+ \ ale_linters#python#vulture#Handle(bufnr(''), [
+ \ ale#path#Simplify(g:dir . '/something_else.py') . ':34: unused variable ''foo'' (60% confidence)',
+ \ ])
+
+Execute(Vulture check for two files should be handled):
+ call ale#test#SetFilename('something_else.py')
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 34,
+ \ 'text': 'unused variable ''foo'' (60% confidence)',
+ \ 'type': 'W',
+ \ 'filename': ale#path#Simplify(g:dir . '/something_else.py'),
+ \ },
+ \ {
+ \ 'lnum': 12,
+ \ 'text': 'unused variable ''bar'' (60% confidence)',
+ \ 'type': 'W',
+ \ 'filename': ale#path#Simplify(g:dir . '/second_one.py'),
+ \ },
+ \ ],
+ \ ale_linters#python#vulture#Handle(bufnr(''), [
+ \ './something_else.py:34: unused variable ''foo'' (60% confidence)',
+ \ './second_one.py:12: unused variable ''bar'' (60% confidence)',
+ \ ])
+
+
+Execute(Vulture exception should be handled):
+ call ale#test#SetFilename('something_else.py')
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'text': 'An exception was thrown. See :ALEDetail',
+ \ 'detail': join([
+ \ 'Traceback (most recent call last):',
+ \ ' File "/usr/lib/python3.6/site-packages/vulture/__init__.py", line 13, in <module>',
+ \ ' from .core import stuff',
+ \ 'BaddestException: Everything gone wrong',
+ \ ], "\n"),
+ \ }
+ \ ],
+ \ ale_linters#python#vulture#Handle(bufnr(''), [
+ \ 'Traceback (most recent call last):',
+ \ ' File "/usr/lib/python3.6/site-packages/vulture/__init__.py", line 13, in <module>',
+ \ ' from .core import stuff',
+ \ 'BaddestException: Everything gone wrong',
+ \ ])
+
+Execute(The vulture handler should handle empty output):
+ AssertEqual
+ \ [],
+ \ ale_linters#python#vulture#Handle(bufnr(''), [])