summaryrefslogtreecommitdiff
path: root/test/handler/test_elmmake_handler.vader
blob: f3424b4b1f00166da2a29d11bf48dbf9850e81b3 (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:
  let b:tmp = has('win32') ? substitute($TMP, '\\', '\\\\', 'g') : $TMPDIR

  runtime ale_linters/elm/make.vim

After:
  unlet! b:tmp
  unlet! g:config_error_lines

  call ale#linter#Reset()

Execute(The elm-make handler should parse lines correctly):
  AssertEqual
  \ [
  \   {
  \     'lnum': 33,
  \     'col': 1,
  \     'end_lnum': 33,
  \     'end_col': 19,
  \     'type': 'W',
  \     'text': 'warning overview',
  \     'detail': "warning overview\n\nwarning details",
  \   },
  \   {
  \     'lnum': 404,
  \     'col': 1,
  \     'end_lnum': 408,
  \     'end_col': 18,
  \     'type': 'E',
  \     'text': 'error overview 1',
  \     'detail': "error overview 1\n\nerror details 1",
  \   },
  \   {
  \     'lnum': 406,
  \     'col': 5,
  \     'end_lnum': 407,
  \     'end_col': 17,
  \     'type': 'E',
  \     'text': 'error overview 2',
  \     'detail': "error overview 2\n\nerror details 2",
  \   },
  \   {
  \     'lnum': 406,
  \     'col': 5,
  \     'end_lnum': 406,
  \     'end_col': 93,
  \     'type': 'E',
  \     'text': 'error overview 3',
  \     'detail': "error overview 3\n\nerror details 3",
  \   },
  \ ],
  \ ale_linters#elm#make#Handle(347, [
  \   '[{"tag":"unused import","overview":"warning overview","details":"warning details","region":{"start":{"line":33,"column":1},"end":{"line":33,"column":19}},"type":"warning","file":"' . b:tmp . 'Module.elm"}]',
  \   '[{"tag":"TYPE MISMATCH","overview":"error overview 1","subregion":{"start":{"line":406,"column":5},"end":{"line":408,"column":18}},"details":"error details 1","region":{"start":{"line":404,"column":1},"end":{"line":408,"column":18}},"type":"error","file":"' . b:tmp . 'Module.elm"},{"tag":"TYPE MISMATCH","overview":"error overview 2","subregion":{"start":{"line":407,"column":12},"end":{"line":407,"column":17}},"details":"error details 2","region":{"start":{"line":406,"column":5},"end":{"line":407,"column":17}},"type":"error","file":"' . b:tmp . 'Module.elm"},{"tag":"TYPE MISMATCH","overview":"error overview 3","subregion":{"start":{"line":406,"column":88},"end":{"line":406,"column":93}},"details":"error details 3","region":{"start":{"line":406,"column":5},"end":{"line":406,"column":93}},"type":"error","file":"' . b:tmp . 'Module.elm"}]'
  \ ])

Execute(The elm-make handler should put an error on the first line if a line cannot be parsed):
  AssertEqual
  \ [
  \   {
  \     'lnum': 33,
  \     'col': 1,
  \     'end_lnum': 33,
  \     'end_col': 19,
  \     'type': 'W',
  \     'text': 'warning overview',
  \     'detail': "warning overview\n\nwarning details",
  \   },
  \   {
  \     'lnum': 1,
  \     'type': 'E',
  \     'text': 'Not JSON',
  \     'detail': "Not JSON\nAlso not JSON",
  \   },
  \ ],
  \ ale_linters#elm#make#Handle(347, [
  \   '[{"tag":"unused import","overview":"warning overview","details":"warning details","region":{"start":{"line":33,"column":1},"end":{"line":33,"column":19}},"type":"warning","file":"' . b:tmp . 'Module.elm"}]',
  \   "Not JSON",
  \   "Also not JSON",
  \ ])