/ test / handler / test_atools_handler.vader
test_atools_handler.vader
 1  Before:
 2    runtime autoload/ale/handlers/atools.vim
 3  
 4  After:
 5    call ale#linter#Reset()
 6  
 7  Execute(The atools handler should handle basic errors or warings):
 8    AssertEqual
 9    \ [
10    \   {
11    \     'lnum': 2,
12    \     'text': 'trailing whitespace',
13    \     'type': 'E',
14    \     'code': 'AL8',
15    \   },
16    \   {
17    \     'lnum': 15,
18    \     'text': '$pkgname should not be used in the source url',
19    \     'type': 'W',
20    \     'code': 'AL29',
21    \   },
22    \ ],
23    \ ale#handlers#atools#Handle(bufnr(''), [
24    \   'IC:[AL8]:APKBUILD:2:trailing whitespace',
25    \   'MC:[AL29]:APKBUILD:15:$pkgname should not be used in the source url',
26    \ ])
27  
28  " Regardless of the severity, if the certainty is [P]ossible and not [C]ertain
29  " or if regardless of the Certainty the Severity is not [I]mportant or [S]erious
30  " then it must be a [W]arning
31  Execute(If we are not Certain or Importantly Serious, be a Warning):
32    AssertEqual
33    \ [
34    \   {
35    \     'lnum': 3,
36    \     'text': 'This violation is Serious but Possible false positive, I am a Warning!',
37    \     'type': 'W',
38    \     'code': 'AL',
39    \   },
40    \   {
41    \     'lnum': 4,
42    \     'text': 'This violation is Important but Possible false positive, I am a Warning!',
43    \     'type': 'W',
44    \     'code': 'AL',
45    \   },
46    \   {
47    \     'lnum': 5,
48    \     'text': 'This violation is Minor, I am a Warning!',
49    \     'type': 'W',
50    \     'code': 'AL',
51    \   },
52    \   {
53    \     'lnum': 6,
54    \     'text': 'This violation is Style, I am a Warning!',
55    \     'type': 'W',
56    \     'code': 'AL',
57    \   },
58    \ ],
59    \ ale#handlers#atools#Handle(bufnr(''), [
60    \   'SP:[AL]:APKBUILD:3:This violation is Serious but Possible false positive, I am a Warning!',
61    \   'IP:[AL]:APKBUILD:4:This violation is Important but Possible false positive, I am a Warning!',
62    \   'MC:[AL]:APKBUILD:5:This violation is Minor, I am a Warning!',
63    \   'TC:[AL]:APKBUILD:6:This violation is Style, I am a Warning!',
64    \ ])
65  
66  Execute(We should be error if we are Certain it is Serious or Important):
67    AssertEqual
68    \ [
69    \   {
70    \     'lnum': 7,
71    \     'text': 'This is Certainly Serious, I am an Error!',
72    \     'type': 'E',
73    \     'code': 'AL',
74    \   },
75    \   {
76    \     'lnum': 8,
77    \     'text': 'This is Certainly Important, I am an Error!',
78    \     'type': 'E',
79    \     'code': 'AL',
80    \   },
81    \ ],
82    \ ale#handlers#atools#Handle(bufnr(''), [
83    \    'SC:[AL]:APKBUILD:7:This is Certainly Serious, I am an Error!',
84    \    'IC:[AL]:APKBUILD:8:This is Certainly Important, I am an Error!',
85    \ ])