summaryrefslogtreecommitdiff
path: root/test/handler/test_nim_handler.vader
blob: b6784d842b4fbf5861843480b90546cbef2bfe39 (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
Before:
  runtime ale_linters/nim/nimcheck.vim

After:
  call ale#linter#Reset()

Execute(Parsing nim errors should work):
  silent file foobar.nim

  AssertEqual
  \ [
  \   {
  \     'lnum': 8,
  \     'col': 8,
  \     'text': 'use {.base.} for base methods; baseless methods are deprecated',
  \     'code': 'UseBase',
  \     'type': 'W',
  \   },
  \   {
  \     'lnum': 12,
  \     'col': 2,
  \     'text': 'identifier expected, but found ''a.barfoo''',
  \     'type': 'E',
  \     'end_col': 9,
  \   },
  \   {
  \     'lnum': 2,
  \     'col': 5,
  \     'text': '''NotUsed'' is declared but not used',
  \     'code': 'XDeclaredButNotUsed',
  \     'type': 'W',
  \     'end_col': 11,
  \   },
  \   {
  \     'lnum': 12,
  \     'col': 2,
  \     'text': 'with : character',
  \     'type': 'E',
  \   },
  \   {
  \     'lnum': 1,
  \     'col': 8,
  \     'text': 'imported and not used: ''strutils''',
  \     'code': 'UnusedImport',
  \     'type': 'W',
  \     'end_col': 15,
  \   },
  \   {
  \     'lnum': 12,
  \     'col': 9,
  \     'text': 'undeclared identifier: ''total''',
  \     'type': 'E',
  \     'end_col': 13,
  \   },
  \   {
  \     'lnum': 14,
  \     'col': 1,
  \     'text': '''sum'' cannot be assigned to',
  \     'type': 'E',
  \     'end_col': 3,
  \   },
  \   {
  \     'lnum': 15,
  \     'col': 1,
  \     'text': 'redefinition of ''getName''; previous declaration here: /nested/folder/foobar.nim(14, 6)',
  \     'type': 'E',
  \     'end_col': 7,
  \   },
  \ ],
  \ ale_linters#nim#nimcheck#Handle(bufnr(''), [
  \ 'Line with wrong( format)',
  \ 'foobar.nim(8, 8) Warning: use {.base.} for base methods; baseless methods are deprecated [UseBase]',
  \ 'foobar.nim(12, 2) Error: identifier expected, but found ''a.barfoo''',
  \ '/nested/folder/foobar.nim(2, 5) Hint: ''NotUsed'' is declared but not used [XDeclaredButNotUsed]',
  \ 'foobar.nim(12, 2) Error: with : character',
  \ 'foobar.nim(1, 8) Warning: imported and not used: ''strutils'' [UnusedImport]',
  \ 'foobar.nim(12, 9) Error: undeclared identifier: ''total''',
  \ 'foobar.nim(14, 1) Error: ''sum'' cannot be assigned to',
  \ 'foobar.nim(15, 1) Error: redefinition of ''getName''; previous declaration here: /nested/folder/foobar.nim(14, 6)',
  \ ])