summaryrefslogtreecommitdiff
path: root/test/handler
diff options
context:
space:
mode:
Diffstat (limited to 'test/handler')
-rw-r--r--test/handler/test_common_handlers.vader8
-rw-r--r--test/handler/test_gcc_handler.vader68
-rw-r--r--test/handler/test_swiftlint_handler.vader8
-rw-r--r--test/handler/test_vint_handler.vader36
4 files changed, 106 insertions, 14 deletions
diff --git a/test/handler/test_common_handlers.vader b/test/handler/test_common_handlers.vader
index 0968a916..f087fb55 100644
--- a/test/handler/test_common_handlers.vader
+++ b/test/handler/test_common_handlers.vader
@@ -55,7 +55,7 @@ Then (The loclist should be correct):
\], g:loclist
Execute (Run HandleGCCFormat):
- let g:loclist = ale#handlers#HandleGCCFormat(42, [
+ let g:loclist = ale#handlers#gcc#HandleGCCFormat(42, [
\ '<stdin>:8:5: warning: conversion lacks type at end of format [-Wformat=]',
\ '<stdin>:10:27: error: invalid operands to binary - (have ‘int’ and ‘char *’)',
\])
@@ -63,18 +63,12 @@ Execute (Run HandleGCCFormat):
Then (The loclist should be correct):
AssertEqual [
\ {
- \ 'bufnr': 42,
- \ 'vcol': 0,
- \ 'nr': -1,
\ 'lnum': 8,
\ 'col': 5,
\ 'type': 'W',
\ 'text': 'conversion lacks type at end of format [-Wformat=]',
\ },
\ {
- \ 'bufnr': 42,
- \ 'vcol': 0,
- \ 'nr': -1,
\ 'lnum': 10,
\ 'col': 27,
\ 'type': 'E',
diff --git a/test/handler/test_gcc_handler.vader b/test/handler/test_gcc_handler.vader
new file mode 100644
index 00000000..3d5a24d4
--- /dev/null
+++ b/test/handler/test_gcc_handler.vader
@@ -0,0 +1,68 @@
+Execute(GCC errors from included files should be parsed correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 3,
+ \ 'type': 'E',
+ \ 'text': 'Problems were found in the header (See :ALEDetail)',
+ \ 'detail': join([
+ \ 'broken.h:1:1: error: expected identifier or ''('' before ''{'' token',
+ \ ' {{{',
+ \ ' ^',
+ \ ], "\n"),
+ \ },
+ \ ],
+ \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ 'In file included from <stdin>:3:0:',
+ \ 'broken.h:1:1: error: expected identifier or ''('' before ''{'' token',
+ \ ' {{{',
+ \ ' ^',
+ \ ])
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 3,
+ \ 'type': 'E',
+ \ 'text': 'Problems were found in the header (See :ALEDetail)',
+ \ 'detail': join([
+ \ 'b.h:1:1: error: expected identifier or ''('' before ''{'' token',
+ \ ' {{{',
+ \ ' ^',
+ \ ], "\n"),
+ \ },
+ \ ],
+ \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ 'In file included from a.h:1:0,',
+ \ ' from test.c:3:',
+ \ 'b.h:1:1: error: expected identifier or ''('' before ''{'' token',
+ \ ' {{{',
+ \ ' ^',
+ \ ])
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 3,
+ \ 'type': 'E',
+ \ 'text': 'Problems were found in the header (See :ALEDetail)',
+ \ 'detail': join([
+ \ '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, [
+ \ 'In file included from a.h:1:0,',
+ \ ' from test.c: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;',
+ \ ' ^',
+ \ ])
diff --git a/test/handler/test_swiftlint_handler.vader b/test/handler/test_swiftlint_handler.vader
index 42fc8242..b77b4420 100644
--- a/test/handler/test_swiftlint_handler.vader
+++ b/test/handler/test_swiftlint_handler.vader
@@ -2,26 +2,20 @@ Execute(The swiftint handler should parse error messages correctly):
AssertEqual
\ [
\ {
- \ 'bufnr': 347,
\ 'lnum': 1,
\ 'col': 7,
\ 'text': 'Operator Usage Whitespace Violation: Operators should be surrounded by a single whitespace when they are being used. (operator_usage_whitespace)',
\ 'type': 'W',
- \ 'vcol': 0,
- \ 'nr': -1,
\ },
\ {
- \ 'bufnr': 347,
\ 'lnum': 1,
\ 'col': 11,
\ 'text': 'Operator Usage Whitespace Violation: Operators should be surrounded by a single whitespace when they are being used. (operator_usage_whitespace)',
\ 'type': 'W',
- \ 'vcol': 0,
- \ 'nr': -1,
\ },
\
\ ],
- \ ale#handlers#HandleGCCFormat(347, [
+ \ ale#handlers#gcc#HandleGCCFormat(347, [
\ 'This line should be ignored',
\ '<nopath>:1:7: warning: Operator Usage Whitespace Violation: Operators should be surrounded by a single whitespace when they are being used. (operator_usage_whitespace)',
\ '<nopath>:1:11: warning: Operator Usage Whitespace Violation: Operators should be surrounded by a single whitespace when they are being used. (operator_usage_whitespace)',
diff --git a/test/handler/test_vint_handler.vader b/test/handler/test_vint_handler.vader
new file mode 100644
index 00000000..efd33d10
--- /dev/null
+++ b/test/handler/test_vint_handler.vader
@@ -0,0 +1,36 @@
+Execute(The vint handler should parse error messages correctly):
+ :file! gxc.vim
+
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 1,
+ \ 'text': 'Use scriptencoding when multibyte char exists (see :help :script encoding)',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'lnum': 3,
+ \ 'col': 17,
+ \ 'text': 'Use robust operators `==#` or `==?` instead of `==` (see Google VimScript Style Guide (Matching))',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'lnum': 3,
+ \ 'col': 8,
+ \ 'text': 'Make the scope explicit like `l:filename` (see Anti-pattern of vimrc (Scope of identifier))',
+ \ 'type': 'W',
+ \ },
+ \ {
+ \ 'lnum': 7,
+ \ 'col': 8,
+ \ 'text': 'Undefined variable: filename (see :help E738)',
+ \ 'type': 'W',
+ \ },
+ \ ],
+ \ ale#handlers#gcc#HandleGCCFormat(347, [
+ \ 'gcc.vim:1:1: warning: Use scriptencoding when multibyte char exists (see :help :script encoding)',
+ \ 'gcc.vim:3:17: warning: Use robust operators `==#` or `==?` instead of `==` (see Google VimScript Style Guide (Matching))',
+ \ 'gcc.vim:3:8: style_problem: Make the scope explicit like `l:filename` (see Anti-pattern of vimrc (Scope of identifier))',
+ \ 'gcc.vim:7:8: warning: Undefined variable: filename (see :help E738)',
+ \ ])