summaryrefslogtreecommitdiff
path: root/test/handler
diff options
context:
space:
mode:
Diffstat (limited to 'test/handler')
-rw-r--r--test/handler/test_gcc_handler.vader35
-rw-r--r--test/handler/test_glslang_handler.vader3
-rw-r--r--test/handler/test_sqllint_handler.vader23
-rw-r--r--test/handler/test_standard_handler.vader8
-rw-r--r--test/handler/test_swiftformat_handler.vader28
-rw-r--r--test/handler/test_vlog_handler.vader12
6 files changed, 105 insertions, 4 deletions
diff --git a/test/handler/test_gcc_handler.vader b/test/handler/test_gcc_handler.vader
index b67483a6..a4231cab 100644
--- a/test/handler/test_gcc_handler.vader
+++ b/test/handler/test_gcc_handler.vader
@@ -279,3 +279,38 @@ Execute(The GCC handler should handle errors for inlined header functions):
\ ' __open_too_many_args ();',
\ ' ^~~~~~~~~~~~~~~~~~~~~~~',
\ ])
+
+Execute(The GCC handler should handle macro expansion errors in current file):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 19,
+ \ 'type': 'E',
+ \ 'text': 'error message',
+ \ 'detail': "error message\n<stdin>:1:19: note: in expansion of macro 'TEST'",
+ \ },
+ \ ],
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
+ \ '<command-line>: error: error message',
+ \ '<stdin>:1:19: note: in expansion of macro ‘TEST’',
+ \ ' 1 | std::string str = TEST;',
+ \ ' | ^~~~',
+ \ ])
+
+Execute(The GCC handler should handle macro expansion errors in other files):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 0,
+ \ 'type': 'E',
+ \ 'text': 'Error found in macro expansion. See :ALEDetail',
+ \ 'detail': "error message\ninc.h:1:19: note: in expansion of macro 'TEST'",
+ \ },
+ \ ],
+ \ ale#handlers#gcc#HandleGCCFormatWithIncludes(347, [
+ \ '<command-line>: error: error message',
+ \ 'inc.h:1:19: note: in expansion of macro ‘TEST’',
+ \ ' 1 | std::string str = TEST;',
+ \ ' | ^~~~',
+ \ ])
diff --git a/test/handler/test_glslang_handler.vader b/test/handler/test_glslang_handler.vader
index d51c9852..6d3a7999 100644
--- a/test/handler/test_glslang_handler.vader
+++ b/test/handler/test_glslang_handler.vader
@@ -1,3 +1,6 @@
+Before:
+ runtime ale_linters/glsl/glslang.vim
+
Execute(The glsl glslang handler should parse lines correctly):
AssertEqual
\ [
diff --git a/test/handler/test_sqllint_handler.vader b/test/handler/test_sqllint_handler.vader
new file mode 100644
index 00000000..2f2283c8
--- /dev/null
+++ b/test/handler/test_sqllint_handler.vader
@@ -0,0 +1,23 @@
+Before:
+ " Load the file which defines the linter.
+ runtime ale_linters/sql/sqllint.vim
+
+After:
+ " Unload all linters again.
+ call ale#linter#Reset()
+
+Execute (The output should be correct):
+
+ " Test that the right loclist items are parsed from the handler.
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 1,
+ \ 'col': 0,
+ \ 'type': '',
+ \ 'text': 'stdin:1 [ER_NO_DB_ERROR] No database selected'
+ \ },
+ \ ],
+ \ ale_linters#sql#sqllint#Handle(bufnr(''), [
+ \ 'stdin:1 [ER_NO_DB_ERROR] No database selected'
+ \ ])
diff --git a/test/handler/test_standard_handler.vader b/test/handler/test_standard_handler.vader
index 59ebe531..31e3a36b 100644
--- a/test/handler/test_standard_handler.vader
+++ b/test/handler/test_standard_handler.vader
@@ -1,3 +1,11 @@
+Before:
+ Save g:ale_javascript_eslint_suppress_eslintignore
+
+ let g:ale_javascript_eslint_suppress_eslintignore = 0
+
+After:
+ Restore
+
Execute(The standard handler should parse lines correctly):
AssertEqual
\ [
diff --git a/test/handler/test_swiftformat_handler.vader b/test/handler/test_swiftformat_handler.vader
new file mode 100644
index 00000000..3dcc4f1a
--- /dev/null
+++ b/test/handler/test_swiftformat_handler.vader
@@ -0,0 +1,28 @@
+Before:
+ runtime ale_linters/swift/swiftformat.vim
+
+After:
+ call ale#linter#Reset()
+
+Execute(The swiftformat handler should parse lines correctly):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 4,
+ \ 'col': 21,
+ \ 'type': 'W',
+ \ 'code': 'DoNotUseSemicolons',
+ \ 'text': 'remove '';'' and move the next statement to the new line',
+ \ },
+ \ {
+ \ 'lnum': 3,
+ \ 'col': 12,
+ \ 'type': 'W',
+ \ 'code': 'Spacing',
+ \ 'text': 'remove 1 space'
+ \ },
+ \ ],
+ \ ale_linters#swift#swiftformat#Handle(bufnr(''), [
+ \ 'Sources/main.swift:4:21: warning: [DoNotUseSemicolons]: remove '';'' and move the next statement to the new line',
+ \ 'Sources/main.swift:3:12: warning: [Spacing]: remove 1 space',
+ \ ])
diff --git a/test/handler/test_vlog_handler.vader b/test/handler/test_vlog_handler.vader
index daf3cdcf..7262f63d 100644
--- a/test/handler/test_vlog_handler.vader
+++ b/test/handler/test_vlog_handler.vader
@@ -10,12 +10,14 @@ Execute(The vlog handler should parse old-style lines correctly):
\ {
\ 'lnum': 7,
\ 'type': 'W',
- \ 'text': '(vlog-2623) Undefined variable: C.'
+ \ 'text': '(vlog-2623) Undefined variable: C.',
+ \ 'filename': 'add.v'
\ },
\ {
\ 'lnum': 1,
\ 'type': 'E',
- \ 'text': '(vlog-13294) Identifier must be declared with a port mode: C.'
+ \ 'text': '(vlog-13294) Identifier must be declared with a port mode: C.',
+ \ 'filename': 'file.v'
\ },
\ ],
\ ale_linters#verilog#vlog#Handle(bufnr(''), [
@@ -29,12 +31,14 @@ Execute(The vlog handler should parse new-style lines correctly):
\ {
\ 'lnum': 7,
\ 'type': 'W',
- \ 'text': '(vlog-2623) Undefined variable: C.'
+ \ 'text': '(vlog-2623) Undefined variable: C.',
+ \ 'filename': 'add.v'
\ },
\ {
\ 'lnum': 1,
\ 'type': 'E',
- \ 'text': '(vlog-13294) Identifier must be declared with a port mode: C.'
+ \ 'text': '(vlog-13294) Identifier must be declared with a port mode: C.',
+ \ 'filename': 'file.v'
\ },
\ ],
\ ale_linters#verilog#vlog#Handle(bufnr(''), [