summaryrefslogtreecommitdiff
path: root/test/handler/test_ghc_handler.vader
blob: b040a234273f0f81998e937a331fe76065169ab1 (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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
Execute(The ghc handler should handle hdevtools output):
  call ale#test#SetFilename('foo.hs')

  AssertEqual
  \ [
  \   {
  \     'lnum': 147,
  \     'type': 'W',
  \     'col': 62,
  \     'text': '• Couldnt match type ‘a -> T.Text’ with ‘T.Text’ Expected type: [T.Text]',
  \     'detail': join([
  \       '• Couldnt match type ‘a -> T.Text’ with ‘T.Text’',
  \       '  Expected type: [T.Text]',
  \     ], "\n"),
  \   },
  \ ],
  \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [
  \ 'foo.hs:147:62: warning:',
  \ '• Couldnt match type ‘a -> T.Text’ with ‘T.Text’',
  \ '  Expected type: [T.Text]',
  \ ])

Execute(The ghc handler should handle ghc 8 output):
  call ale#test#SetFilename('src/Appoint/Lib.hs')

  AssertEqual
  \ [
  \   {
  \     'lnum': 6,
  \     'type': 'E',
  \     'col': 1,
  \     'text': 'Failed to load interface for ‘GitHub.Data’ Use -v to see a list of the files searched for.',
  \     'detail': join([
  \       '    Failed to load interface for ‘GitHub.Data’',
  \       '    Use -v to see a list of the files searched for.',
  \     ], "\n"),
  \   },
  \   {
  \     'lnum': 7,
  \     'type': 'W',
  \     'col': 1,
  \     'text': 'Failed to load interface for ‘GitHub.Endpoints.PullRequests’ Use -v to see a list of the files searched for.',
  \     'detail': join([
  \       '    Failed to load interface for ‘GitHub.Endpoints.PullRequests’',
  \       '    Use -v to see a list of the files searched for.',
  \     ], "\n"),
  \   },
  \ ],
  \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [
  \ '',
  \ ale#path#Simplify('src/Appoint/Lib.hs') . ':6:1: error:',
  \ '    Failed to load interface for ‘GitHub.Data’',
  \ '    Use -v to see a list of the files searched for.',
  \ '',
  \ ale#path#Simplify('src/Appoint/Lib.hs') . ':7:1: warning:',
  \ '    Failed to load interface for ‘GitHub.Endpoints.PullRequests’',
  \ '    Use -v to see a list of the files searched for.',
  \ ])

Execute(The ghc handler should handle ghc 7 output):
  call ale#test#SetFilename('src/Main.hs')

  AssertEqual
  \ [
  \   {
  \     'lnum': 168,
  \     'type': 'E',
  \     'col': 1,
  \     'text': 'parse error (possibly incorrect indentation or mismatched brackets)',
  \     'detail': join([
  \       '    parse error (possibly incorrect indentation or mismatched brackets)',
  \     ], "\n"),
  \   },
  \   {
  \     'lnum': 84,
  \     'col': 1,
  \     'type': 'W',
  \     'text': 'Top-level binding with no type signature: myLayout :: Choose Tall (Choose (Mirror Tall) Full) a',
  \     'detail': join([
  \       '    Top-level binding with no type signature:',
  \       '    myLayout :: Choose Tall (Choose (Mirror Tall) Full) a',
  \     ], "\n"),
  \   },
  \   {
  \     'lnum': 94,
  \     'col': 5,
  \     'type': 'E',
  \     'text': 'Some other error',
  \     'detail': join([
  \       '  Some other error',
  \     ], "\n"),
  \   },
  \ ],
  \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [
  \ ale#path#Simplify('src/Main.hs') . ':168:1:',
  \ '    parse error (possibly incorrect indentation or mismatched brackets)',
  \ ale#path#Simplify('src/Main.hs') . ':84:1:Warning:',
  \ '    Top-level binding with no type signature:',
  \ '    myLayout :: Choose Tall (Choose (Mirror Tall) Full) a',
  \ ale#path#Simplify('src/Main.hs') . ':94:5:Error:',
  \ '  Some other error',
  \ ])

Execute(The ghc handler should handle stack 1.5.1 output):
  call ale#test#SetFilename('src/Main.hs')

  AssertEqual
  \ [
  \   {
  \     'lnum': 160,
  \     'col': 14,
  \     'type': 'E',
  \     'text': '• Expecting one fewer arguments to ‘Exp’ Expected kind ‘k0 -> *’, but ‘Exp’ has kind ‘*’ • In the type ‘Exp a’ | 160 | pattern F :: Exp a |              ^^^^^',
  \     'detail': join([
  \       '        • Expecting one fewer arguments to ‘Exp’',
  \       '          Expected kind ‘k0 -> *’, but ‘Exp’ has kind ‘*’',
  \       '        • In the type ‘Exp a’',
  \       '        |',
  \       '    160 | pattern F :: Exp a',
  \       '        |              ^^^^^',
  \     ], "\n"),
  \   },
  \ ],
  \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [
  \   '    ' . ale#path#Simplify('src/Main.hs') . ':160:14: error:',
  \   '        • Expecting one fewer arguments to ‘Exp’',
  \   '          Expected kind ‘k0 -> *’, but ‘Exp’ has kind ‘*’',
  \   '        • In the type ‘Exp a’',
  \   '        |',
  \   '    160 | pattern F :: Exp a',
  \   '        |              ^^^^^',
  \ ])