summaryrefslogtreecommitdiff
path: root/test/handler/test_redpen_handler.vader
blob: 0b030e2de809de293911b28d99f3faaced46ff69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
Before:
  runtime! ale_linters/markdown/redpen.vim

After:
  call ale#linter#Reset()

Execute(redpen handler should handle errors output):
  AssertEqual
  \ [
  \   {
  \     'lnum': 1,
  \     'col': 10,
  \     'end_lnum': 1,
  \     'end_col': 15,
  \     'text': 'Found possibly misspelled word "plugin".',
  \     'type': 'W',
  \     'code': 'Spelling',
  \   },
  \   {
  \     'lnum': 1,
  \     'col': 1,
  \     'text': 'Found possibly misspelled word "NeoVim".',
  \     'type': 'W',
  \     'code': 'Spelling',
  \   },
  \   {
  \     'lnum': 1,
  \     'col': 35,
  \     'end_lnum': 1,
  \     'end_col': 55,
  \     'text': 'Found possibly misspelled word "コードチェック".',
  \     'type': 'W',
  \     'code': 'Spelling',
  \   },
  \ ],
  \ ale#handlers#redpen#HandleRedpenOutput(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\"."',
  \   '      },',
  \   '      {',
  \   '        "sentence": "ALEはNeoVimとVim8で非同期のコードチェックを実現するプラグインです。",',
  \   '        "endPosition": {',
  \   '          "offset": 27,',
  \   '          "lineNum": 1',
  \   '        },',
  \   '        "validator": "Spelling",',
  \   '        "lineNum": 1,',
  \   '        "sentenceStartColumnNum": 0,',
  \   '        "message": "Found possibly misspelled word \"コードチェック\".",',
  \   '        "startPosition": {',
  \   '          "offset": 20,',
  \   '          "lineNum": 1',
  \   '        }',
  \   '      }',
  \   '    ]',
  \   '  }',
  \   ']',
  \ ])

Execute(The redpen handler should handle an empty error list):
  AssertEqual
  \ [],
  \ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [
  \   '[',
  \   '  {',
  \   '    "document": "test.md",',
  \   '    "errors": []',
  \   '  }',
  \   ']',
  \ ])

Execute(The redpen handler should handle totally empty output):
  AssertEqual
  \ [],
  \ ale#handlers#redpen#HandleRedpenOutput(bufnr(''), [])