summaryrefslogtreecommitdiff
path: root/test/handler/test_hlint_handler.vader
blob: 915e174828306407049fdc51b9054d60a4ae3bbb (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/haskell/hlint.vim

After:
  call ale#linter#Reset()

Execute(The hlint handler should parse items correctly):
  AssertEqual
  \ [
  \   {
  \     'lnum': 1,
  \     'col': 4,
  \     'end_lnum': 3,
  \     'end_col': 2,
  \     'text': 'Error: Do something. Found: [Char] Why not: String',
  \     'type': 'E',
  \   },
  \   {
  \     'lnum': 2,
  \     'col': 4,
  \     'end_lnum': 7,
  \     'end_col': 2,
  \     'text': 'Warning: Do something. Found: [Char] Why not: String',
  \     'type': 'W',
  \   },
  \   {
  \     'lnum': 73,
  \     'col': 25,
  \     'end_lnum': 73,
  \     'end_col': 31,
  \     'text': 'Suggestion: Use String. Found: [Char] Why not: String',
  \     'type': 'I',
  \   },
  \ ],
  \ ale_linters#haskell#hlint#Handle(bufnr(''), [json_encode([
  \   {
  \     'module': 'Main',
  \     'decl': 'foo',
  \     'severity': 'Error',
  \     'hint': 'Do something',
  \     'file': '-',
  \     'startLine': 1,
  \     'startColumn': 4,
  \     'endLine': 3,
  \     'endColumn': 2,
  \     'from': '[Char]',
  \     'to': 'String',
  \   },
  \   {
  \     'module': 'Main',
  \     'decl': 'foo',
  \     'severity': 'Warning',
  \     'hint': 'Do something',
  \     'file': '-',
  \     'startLine': 2,
  \     'startColumn': 4,
  \     'endLine': 7,
  \     'endColumn': 2,
  \     'from': '[Char]',
  \     'to': 'String',
  \   },
  \   {
  \     'module': 'Main',
  \     'decl': 'myFocusedBorderColor',
  \     'severity': 'Suggestion',
  \     'hint': 'Use String',
  \     'file': '-',
  \     'startLine': 73,
  \     'startColumn': 25,
  \     'endLine': 73,
  \     'endColumn': 31,
  \     'from': '[Char]',
  \     'to': 'String',
  \   },
  \ ])])

Execute(The hlint handler should handle empty output):
  AssertEqual
  \ [],
  \ ale_linters#haskell#hlint#Handle(bufnr(''), [])