summaryrefslogtreecommitdiff
path: root/test/handler/test_sql_sqlfluff_handler.vader
diff options
context:
space:
mode:
authorCarl Smedstad <carl.smedstad@protonmail.com>2022-11-21 11:50:45 +0100
committerGitHub <noreply@github.com>2022-11-21 19:50:45 +0900
commit6c4be47437707bd6e9afc6a09d7bfec15864f2d3 (patch)
tree92b63673d4472f413191d51ec4c7adc3a664b998 /test/handler/test_sql_sqlfluff_handler.vader
parentca355f4cb45ea3508548045ca7b9cc73f3741e69 (diff)
downloadale-6c4be47437707bd6e9afc6a09d7bfec15864f2d3.zip
Implement support for SQL linter sqlfluff (#4361)
Diffstat (limited to 'test/handler/test_sql_sqlfluff_handler.vader')
-rw-r--r--test/handler/test_sql_sqlfluff_handler.vader39
1 files changed, 39 insertions, 0 deletions
diff --git a/test/handler/test_sql_sqlfluff_handler.vader b/test/handler/test_sql_sqlfluff_handler.vader
new file mode 100644
index 00000000..f1f684bd
--- /dev/null
+++ b/test/handler/test_sql_sqlfluff_handler.vader
@@ -0,0 +1,39 @@
+Before:
+ runtime ale_linters/sql/sqlfluff.vim
+
+After:
+ Restore
+
+ call ale#linter#Reset()
+
+Execute(The sqlfluff handler should handle basic warnings):
+ AssertEqual
+ \ [
+ \ {
+ \ 'filename': 'schema.sql',
+ \ 'lnum': 1,
+ \ 'col': 8,
+ \ 'type': 'W',
+ \ 'code': 'L010',
+ \ 'text': 'Keywords must be consistently upper case.',
+ \ },
+ \ {
+ \ 'filename': 'schema.sql',
+ \ 'lnum': 13,
+ \ 'col': 2,
+ \ 'type': 'W',
+ \ 'code': 'L003',
+ \ 'text': 'Expected 1 indentation, found 0 [compared to line 12]',
+ \ },
+ \ {
+ \ 'filename': 'schema.sql',
+ \ 'lnum': 16,
+ \ 'col': 1,
+ \ 'type': 'W',
+ \ 'code': 'L009',
+ \ 'text': 'Files must end with a single trailing newline.',
+ \ },
+ \ ],
+ \ ale_linters#sql#sqlfluff#Handle(1, [
+ \ '[{"filepath": "schema.sql", "violations": [{"line_no": 1, "line_pos": 8, "code": "L010", "description": "Keywords must be consistently upper case."}, {"line_no": 13, "line_pos": 2, "code": "L003", "description": "Expected 1 indentation, found 0 [compared to line 12]"}, {"line_no": 16, "line_pos": 1, "code": "L009", "description": "Files must end with a single trailing newline."}]}]',
+ \ ])