summaryrefslogtreecommitdiff
path: root/test/handler
diff options
context:
space:
mode:
authorw0rp <w0rp@users.noreply.github.com>2017-12-18 10:11:57 +0000
committerGitHub <noreply@github.com>2017-12-18 10:11:57 +0000
commitfdde8af894772d489bf8105d9d056ccfef31cd8b (patch)
tree8d5ba5c2f5274dd928b3fbf5ac4df0bdd684f711 /test/handler
parent30c5bb37726df76a790b9bb25280cf0c9f885bc6 (diff)
parent96b90b45db5070c964adb14f1a0ac67c61571648 (diff)
downloadale-fdde8af894772d489bf8105d9d056ccfef31cd8b.zip
Merge pull request #1232 from languitar/vale-json
Use JSON output with vale
Diffstat (limited to 'test/handler')
-rw-r--r--test/handler/test_vale_handler.vader67
1 files changed, 67 insertions, 0 deletions
diff --git a/test/handler/test_vale_handler.vader b/test/handler/test_vale_handler.vader
new file mode 100644
index 00000000..afc32db9
--- /dev/null
+++ b/test/handler/test_vale_handler.vader
@@ -0,0 +1,67 @@
+Execute(The vale handler should handle broken JSON):
+ AssertEqual
+ \ [],
+ \ ale#handlers#vale#Handle(bufnr(''), ["{asdf"])
+
+Execute(The vale handler should handle am empty string response):
+ AssertEqual
+ \ [],
+ \ ale#handlers#vale#Handle(bufnr(''), [])
+
+Execute(The vale handler should handle an empty result):
+ AssertEqual
+ \ [],
+ \ ale#handlers#vale#Handle(bufnr(''), ["{}"])
+
+Execute(The vale handler should handle a normal example):
+ AssertEqual
+ \ [
+ \ {
+ \ 'lnum': 5,
+ \ 'col': 195,
+ \ 'end_col': 201,
+ \ 'type': 'W',
+ \ 'text': "Consider removing 'usually'",
+ \ 'code': 'vale.Hedging',
+ \ },
+ \ {
+ \ 'lnum': 7,
+ \ 'col': 1,
+ \ 'end_col': 27,
+ \ 'type': 'E',
+ \ 'text': "'Documentation' is repeated!",
+ \ 'code': 'vale.Repetition',
+ \ },
+ \ ],
+ \ ale#handlers#vale#Handle(bufnr(''), [
+ \ '{',
+ \ ' "/home/languitar/src/autosuspend/README.md": [',
+ \ ' {',
+ \ ' "Check": "vale.Hedging",',
+ \ ' "Description": "",',
+ \ ' "Line": 5,',
+ \ ' "Link": "",',
+ \ " \"Message\": \"Consider removing 'usually'\",",
+ \ ' "Severity": "warning",',
+ \ ' "Span": [',
+ \ ' 195,',
+ \ ' 201',
+ \ ' ],',
+ \ ' "Hide": false',
+ \ ' },',
+ \ ' {',
+ \ ' "Check": "vale.Repetition",',
+ \ ' "Description": "",',
+ \ ' "Line": 7,',
+ \ ' "Link": "",',
+ \ " \"Message\": \"'Documentation' is repeated!\",",
+ \ ' "Severity": "error",',
+ \ ' "Span": [',
+ \ ' 1,',
+ \ ' 27',
+ \ ' ],',
+ \ ' "Hide": false',
+ \ ' }',
+ \ ' ]',
+ \ '}',
+ \ ])