summaryrefslogtreecommitdiff
path: root/test/handler/test_nix_handler.vader
blob: 87e8b68f7c840f9bb14a7b25faf5b26191ccdd27 (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
Before:
  runtime ale_linters/nix/nix.vim

After:
  call ale#linter#Reset()

Execute(The nix handler should parse nix-instantiate error messages correctly):
  AssertEqual
  \ [
  \   {
  \     'lnum': 6,
  \     'col': 3,
  \     'type': 'E',
  \     'text': "syntax error, unexpected ']', expecting ';'",
  \   },
  \   {
  \     'lnum': 3,
  \     'col': 5,
  \     'type': 'E',
  \     'text': "undefined variable 'foo'",
  \   },
  \
  \ ],
  \ ale_linters#nix#nix#Handle(bufnr(''), [
  \   "@nix {\"line\":6,\"column\":3,\"raw_msg\":\"syntax error, unexpected ']', expecting ';'\"}",
  \   "@nix {\"line\":3,\"column\":5,\"raw_msg\":\"undefined variable 'foo'\"}",
  \   "@nix {\"unrelated\":\"message\"}"
  \ ])

Execute(The nix handler should parse message from old nix-instantiate correctly):
  AssertEqual
  \ [
  \   {
  \     'lnum': 23,
  \     'col': 14,
  \     'text': 'error: syntax error, unexpected IN',
  \     'type': 'E',
  \   },
  \   {
  \     'lnum': 3,
  \     'col': 12,
  \     'text': 'error: syntax error, unexpected ''='', expecting '';''',
  \     'type': 'E',
  \   },
  \
  \ ],
  \ ale_linters#nix#nix#Handle(47, [
  \   'This line should be ignored',
  \   'error: syntax error, unexpected IN, at /path/to/filename.nix:23:14',
  \   'error: syntax error, unexpected ''='', expecting '';'', at /path/to/filename.nix:3:12',
  \ ])