summaryrefslogtreecommitdiff
path: root/test/handler/test_vale_handler.vader
blob: 37badb476ed92008dfd211954f296263a2396305 (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
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',
  \   },
  \   {
  \     'lnum': 7,
  \     'col': 1,
  \     'end_col': 27,
  \     'type': 'I',
  \     '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',
  \   '    },',
  \   '    {',
  \   '      "Check": "vale.Repetition",',
  \   '      "Description": "",',
  \   '      "Line": 7,',
  \   '      "Link": "",',
  \   "      \"Message\": \"'Documentation' is repeated!\",",
  \   '      "Severity": "suggestion",',
  \   '      "Span": [',
  \   '        1,',
  \   '        27',
  \   '      ],',
  \   '      "Hide": false',
  \   '    }',
  \   '  ]',
  \   '}',
  \ ])