/ test / handler / test_redpen_handler.vader
test_redpen_handler.vader
 1  Before:
 2    runtime! ale_linters/markdown/redpen.vim
 3  
 4  After:
 5    call ale#linter#Reset()
 6  
 7  Execute(redpen handler should handle errors output):
 8    AssertEqual
 9    \ [
10    \   {
11    \     'lnum': 1,
12    \     'col': 10,
13    \     'end_lnum': 1,
14    \     'end_col': 15,
15    \     'text': 'Found possibly misspelled word "plugin".',
16    \     'type': 'W',
17    \     'code': 'Spelling',
18    \   },
19    \   {
20    \     'lnum': 1,
21    \     'col': 1,
22    \     'text': 'Found possibly misspelled word "NeoVim".',
23    \     'type': 'W',
24    \     'code': 'Spelling',
25    \   },
26    \   {
27    \     'lnum': 1,
28    \     'col': 35,
29    \     'end_lnum': 1,
30    \     'end_col': 55,
31    \     'text': 'Found possibly misspelled word "コードチェック".',
32    \     'type': 'W',
33    \     'code': 'Spelling',
34    \   },
35    \ ],
36    \ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [
37    \   '[',
38    \   '  {',
39    \   '    "document": "test.md",',
40    \   '    "errors": [',
41    \   '      {',
42    \   '        "sentence": "ALE is a plugin for providing linting in NeoVim and Vim 8 while you edit your text files.",',
43    \   '        "endPosition": {',
44    \   '          "offset": 15,',
45    \   '          "lineNum": 1',
46    \   '        },',
47    \   '        "validator": "Spelling",',
48    \   '        "lineNum": 1,',
49    \   '        "sentenceStartColumnNum": 0,',
50    \   '        "message": "Found possibly misspelled word \"plugin\".",',
51    \   '        "startPosition": {',
52    \   '          "offset": 9,',
53    \   '          "lineNum": 1',
54    \   '        }',
55    \   '      },',
56    \   '      {',
57    \   '        "sentence": "ALE is a plugin for providing linting in NeoVim and Vim 8 while you edit your text files.",',
58    \   '        "validator": "Spelling",',
59    \   '        "lineNum": 1,',
60    \   '        "sentenceStartColumnNum": 0,',
61    \   '        "message": "Found possibly misspelled word \"NeoVim\"."',
62    \   '      },',
63    \   '      {',
64    \   '        "sentence": "ALEはNeoVimとVim8で非同期のコードチェックを実現するプラグインです。",',
65    \   '        "endPosition": {',
66    \   '          "offset": 27,',
67    \   '          "lineNum": 1',
68    \   '        },',
69    \   '        "validator": "Spelling",',
70    \   '        "lineNum": 1,',
71    \   '        "sentenceStartColumnNum": 0,',
72    \   '        "message": "Found possibly misspelled word \"コードチェック\".",',
73    \   '        "startPosition": {',
74    \   '          "offset": 20,',
75    \   '          "lineNum": 1',
76    \   '        }',
77    \   '      }',
78    \   '    ]',
79    \   '  }',
80    \   ']',
81    \ ])
82  
83  Execute(The redpen handler should handle an empty error list):
84    AssertEqual
85    \ [],
86    \ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [
87    \   '[',
88    \   '  {',
89    \   '    "document": "test.md",',
90    \   '    "errors": []',
91    \   '  }',
92    \   ']',
93    \ ])
94  
95  Execute(The redpen handler should handle totally empty output):
96    AssertEqual
97    \ [],
98    \ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [])