From c9c52ef370f6abbcf60220e047faebd294bd738b Mon Sep 17 00:00:00 2001 From: rhysd Date: Thu, 16 Nov 2017 18:36:53 +0900 Subject: [PATCH] add tests and doc for redpen support --- README.md | 2 +- doc/ale.txt | 2 +- test/handler/test_redpen_handler.vader | 65 ++++++++++++++++++++++++++ 3 files changed, 67 insertions(+), 2 deletions(-) create mode 100644 test/handler/test_redpen_handler.vader diff --git a/README.md b/README.md index cf812af..810b90e 100644 --- a/README.md +++ b/README.md @@ -114,7 +114,7 @@ formatting. | Lua | [luacheck](https://github.com/mpeterv/luacheck) | | Mail | [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale) | | Make | [checkmake](https://github.com/mrtazz/checkmake) | -| Markdown | [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale), [remark-lint](https://github.com/wooorm/remark-lint) !!, [write-good](https://github.com/btford/write-good) | +| Markdown | [mdl](https://github.com/mivok/markdownlint), [proselint](http://proselint.com/), [vale](https://github.com/ValeLint/vale), [remark-lint](https://github.com/wooorm/remark-lint) !!, [write-good](https://github.com/btford/write-good), [redpen](http://redpen.cc/) | | MATLAB | [mlint](https://www.mathworks.com/help/matlab/ref/mlint.html) | | Nim | [nim check](https://nim-lang.org/docs/nimc.html) !! | | nix | [nix-instantiate](http://nixos.org/nix/manual/#sec-nix-instantiate) | diff --git a/doc/ale.txt b/doc/ale.txt index 9947d09..8e2e595 100644 --- a/doc/ale.txt +++ b/doc/ale.txt @@ -304,7 +304,7 @@ Notes: * Lua: `luacheck` * Mail: `proselint`, `vale` * Make: `checkmake` -* Markdown: `mdl`, `proselint`, `vale`, `remark-lint`, `write-good` +* Markdown: `mdl`, `proselint`, `vale`, `remark-lint`, `write-good`, `redpen` * MATLAB: `mlint` * Nim: `nim check`!! * nix: `nix-instantiate` diff --git a/test/handler/test_redpen_handler.vader b/test/handler/test_redpen_handler.vader new file mode 100644 index 0000000..2ea3a2f --- /dev/null +++ b/test/handler/test_redpen_handler.vader @@ -0,0 +1,65 @@ +Before: + runtime! ale_linters/markdown/redpen.vim + +After: + call ale#linter#Reset() + +Execute(redpen handler should handle errors output): + AssertEqual + \ [ + \ { + \ 'lnum': 1, + \ 'col': 9, + \ 'text': 'Found possibly misspelled word "plugin". (Spelling)', + \ 'type': 'W', + \ }, + \ { + \ 'lnum': 1, + \ 'col': 1, + \ 'text': 'Found possibly misspelled word "NeoVim". (Spelling)', + \ 'type': 'W', + \ }, + \ ], + \ ale_linters#markdown#redpen#HandleErrors(bufnr(''), [ + \ '[', + \ ' {', + \ ' "document": "test.md",', + \ ' "errors": [', + \ ' {', + \ ' "sentence": "ALE is a plugin for providing linting in NeoVim and Vim 8 while you edit your text files.",', + \ ' "endPosition": {', + \ ' "offset": 15,', + \ ' "lineNum": 1', + \ ' },', + \ ' "validator": "Spelling",', + \ ' "lineNum": 1,', + \ ' "sentenceStartColumnNum": 0,', + \ ' "message": "Found possibly misspelled word \"plugin\".",', + \ ' "startPosition": {', + \ ' "offset": 9,', + \ ' "lineNum": 1', + \ ' }', + \ ' },', + \ ' {', + \ ' "sentence": "ALE is a plugin for providing linting in NeoVim and Vim 8 while you edit your text files.",', + \ ' "validator": "Spelling",', + \ ' "lineNum": 1,', + \ ' "sentenceStartColumnNum": 0,', + \ ' "message": "Found possibly misspelled word \"NeoVim\".",', + \ ' }', + \ ' ]', + \ ' }', + \ ']', + \ ]) + +Execute(redpen handler should no error output): + AssertEqual + \ [], + \ ale_linters#markdown#redpen#HandleErrors(bufnr(''), [ + \ '[', + \ ' {', + \ ' "document": "test.md",', + \ ' "errors": []', + \ ' }', + \ ']', + \ ])