/ test / handler / test_nim_handler.vader
test_nim_handler.vader
 1  Before:
 2    runtime ale_linters/nim/nimcheck.vim
 3  
 4  After:
 5    call ale#linter#Reset()
 6  
 7  Execute(Parsing nim errors should work):
 8    silent file foobar.nim
 9  
10    AssertEqual
11    \ [
12    \   {
13    \     'lnum': 8,
14    \     'col': 8,
15    \     'text': 'use {.base.} for base methods; baseless methods are deprecated',
16    \     'code': 'UseBase',
17    \     'type': 'W',
18    \   },
19    \   {
20    \     'lnum': 12,
21    \     'col': 2,
22    \     'text': 'identifier expected, but found ''a.barfoo''',
23    \     'type': 'E',
24    \     'end_col': 9,
25    \   },
26    \   {
27    \     'lnum': 2,
28    \     'col': 5,
29    \     'text': '''NotUsed'' is declared but not used',
30    \     'code': 'XDeclaredButNotUsed',
31    \     'type': 'W',
32    \     'end_col': 11,
33    \   },
34    \   {
35    \     'lnum': 12,
36    \     'col': 2,
37    \     'text': 'with : character',
38    \     'type': 'E',
39    \   },
40    \   {
41    \     'lnum': 1,
42    \     'col': 8,
43    \     'text': 'imported and not used: ''strutils''',
44    \     'code': 'UnusedImport',
45    \     'type': 'W',
46    \     'end_col': 15,
47    \   },
48    \   {
49    \     'lnum': 12,
50    \     'col': 9,
51    \     'text': 'undeclared identifier: ''total''',
52    \     'type': 'E',
53    \     'end_col': 13,
54    \   },
55    \   {
56    \     'lnum': 14,
57    \     'col': 1,
58    \     'text': '''sum'' cannot be assigned to',
59    \     'type': 'E',
60    \     'end_col': 3,
61    \   },
62    \   {
63    \     'lnum': 15,
64    \     'col': 1,
65    \     'text': 'redefinition of ''getName''; previous declaration here: /nested/folder/foobar.nim(14, 6)',
66    \     'type': 'E',
67    \     'end_col': 7,
68    \   },
69    \ ],
70    \ ale_linters#nim#nimcheck#Handle(bufnr(''), [
71    \ 'Line with wrong( format)',
72    \ 'foobar.nim(8, 8) Warning: use {.base.} for base methods; baseless methods are deprecated [UseBase]',
73    \ 'foobar.nim(12, 2) Error: identifier expected, but found ''a.barfoo''',
74    \ '/nested/folder/foobar.nim(2, 5) Hint: ''NotUsed'' is declared but not used [XDeclaredButNotUsed]',
75    \ 'foobar.nim(12, 2) Error: with : character',
76    \ 'foobar.nim(1, 8) Warning: imported and not used: ''strutils'' [UnusedImport]',
77    \ 'foobar.nim(12, 9) Error: undeclared identifier: ''total''',
78    \ 'foobar.nim(14, 1) Error: ''sum'' cannot be assigned to',
79    \ 'foobar.nim(15, 1) Error: redefinition of ''getName''; previous declaration here: /nested/folder/foobar.nim(14, 6)',
80    \ ])