]> git.madduck.net Git - etc/vim.git/blob - .vim/bundle/ale/test/handler/test_ghc_handler.vader

madduck's git repository

Every one of the projects in this repository is available at the canonical URL git://git.madduck.net/madduck/pub/<projectpath> — see each project's metadata for the exact URL.

All patches and comments are welcome. Please squash your changes to logical commits before using git-format-patch and git-send-email to patches@git.madduck.net. If you'd read over the Git project's submission guidelines and adhered to them, I'd be especially grateful.

SSH access, as well as push access can be individually arranged.

If you use my repositories frequently, consider adding the following snippet to ~/.gitconfig and using the third clone URL listed for each project:

[url "git://git.madduck.net/madduck/"]
  insteadOf = madduck:

Merge commit '76265755a1add77121c8f9dabb3e9bb70fe9a972' as '.vim/bundle/ale'
[etc/vim.git] / .vim / bundle / ale / test / handler / test_ghc_handler.vader
1 After:
2   unlet! g:detail
3
4 Execute(The ghc handler should handle hdevtools output):
5   call ale#test#SetFilename('foo.hs')
6
7   AssertEqual
8   \ [
9   \   {
10   \     'lnum': 147,
11   \     'type': 'W',
12   \     'col': 62,
13   \     'text': "• Couldn't match type ‘a -> T.Text’ with ‘T.Text’ Expected type: [T.Text]",
14   \     'detail': join([
15   \       "• Couldn't match type ‘a -> T.Text’ with ‘T.Text’",
16   \       '  Expected type: [T.Text]',
17   \     ], "\n"),
18   \   },
19   \ ],
20   \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [
21   \ 'foo.hs:147:62: warning:',
22   \ "• Couldn't match type ‘a -> T.Text’ with ‘T.Text’",
23   \ '  Expected type: [T.Text]',
24   \ ])
25
26 Execute(The ghc handler should handle ghc 8 output):
27   call ale#test#SetFilename('src/Appoint/Lib.hs')
28
29   AssertEqual
30   \ [
31   \   {
32   \     'lnum': 6,
33   \     'type': 'E',
34   \     'col': 1,
35   \     'text': 'Failed to load interface for ‘GitHub.Data’ Use -v to see a list of the files searched for.',
36   \     'detail': join([
37   \       '    Failed to load interface for ‘GitHub.Data’',
38   \       '    Use -v to see a list of the files searched for.',
39   \     ], "\n"),
40   \   },
41   \   {
42   \     'lnum': 7,
43   \     'type': 'W',
44   \     'col': 1,
45   \     'text': 'Failed to load interface for ‘GitHub.Endpoints.PullRequests’ Use -v to see a list of the files searched for.',
46   \     'detail': join([
47   \       '    Failed to load interface for ‘GitHub.Endpoints.PullRequests’',
48   \       '    Use -v to see a list of the files searched for.',
49   \     ], "\n"),
50   \   },
51   \ ],
52   \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [
53   \ '',
54   \ ale#path#Simplify('src/Appoint/Lib.hs') . ':6:1: error:',
55   \ '    Failed to load interface for ‘GitHub.Data’',
56   \ '    Use -v to see a list of the files searched for.',
57   \ '',
58   \ ale#path#Simplify('src/Appoint/Lib.hs') . ':7:1: warning:',
59   \ '    Failed to load interface for ‘GitHub.Endpoints.PullRequests’',
60   \ '    Use -v to see a list of the files searched for.',
61   \ ])
62
63 Execute(The ghc handler should handle ghc 7 output):
64   call ale#test#SetFilename('src/Main.hs')
65
66   AssertEqual
67   \ [
68   \   {
69   \     'lnum': 168,
70   \     'type': 'E',
71   \     'col': 1,
72   \     'text': 'parse error (possibly incorrect indentation or mismatched brackets)',
73   \     'detail': join([
74   \       '    parse error (possibly incorrect indentation or mismatched brackets)',
75   \     ], "\n"),
76   \   },
77   \   {
78   \     'lnum': 84,
79   \     'col': 1,
80   \     'type': 'W',
81   \     'text': 'Top-level binding with no type signature: myLayout :: Choose Tall (Choose (Mirror Tall) Full) a',
82   \     'detail': join([
83   \       '    Top-level binding with no type signature:',
84   \       '    myLayout :: Choose Tall (Choose (Mirror Tall) Full) a',
85   \     ], "\n"),
86   \   },
87   \   {
88   \     'lnum': 94,
89   \     'col': 5,
90   \     'type': 'E',
91   \     'text': 'Some other error',
92   \     'detail': join([
93   \       '  Some other error',
94   \     ], "\n"),
95   \   },
96   \ ],
97   \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [
98   \ ale#path#Simplify('src/Main.hs') . ':168:1:',
99   \ '    parse error (possibly incorrect indentation or mismatched brackets)',
100   \ ale#path#Simplify('src/Main.hs') . ':84:1:Warning:',
101   \ '    Top-level binding with no type signature:',
102   \ '    myLayout :: Choose Tall (Choose (Mirror Tall) Full) a',
103   \ ale#path#Simplify('src/Main.hs') . ':94:5:Error:',
104   \ '  Some other error',
105   \ ])
106
107 Execute(The ghc handler should handle stack 1.5.1 output):
108   call ale#test#SetFilename('src/Main.hs')
109
110   AssertEqual
111   \ [
112   \   {
113   \     'lnum': 160,
114   \     'col': 14,
115   \     'type': 'E',
116   \     'text': '• Expecting one fewer arguments to ‘Exp’ Expected kind ‘k0 -> *’, but ‘Exp’ has kind ‘*’ • In the type ‘Exp a’ | 160 | pattern F :: Exp a |              ^^^^^',
117   \     'detail': join([
118   \       '        • Expecting one fewer arguments to ‘Exp’',
119   \       '          Expected kind ‘k0 -> *’, but ‘Exp’ has kind ‘*’',
120   \       '        • In the type ‘Exp a’',
121   \       '        |',
122   \       '    160 | pattern F :: Exp a',
123   \       '        |              ^^^^^',
124   \     ], "\n"),
125   \   },
126   \ ],
127   \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), [
128   \   '    ' . ale#path#Simplify('src/Main.hs') . ':160:14: error:',
129   \   '        • Expecting one fewer arguments to ‘Exp’',
130   \   '          Expected kind ‘k0 -> *’, but ‘Exp’ has kind ‘*’',
131   \   '        • In the type ‘Exp a’',
132   \   '        |',
133   \   '    160 | pattern F :: Exp a',
134   \   '        |              ^^^^^',
135   \ ])
136
137 Execute(The ghc handler should handle ghc panic):
138   let g:detail = [
139     \      '[15 of 15] Compiling SizedTypes.List',
140     \      'ghc: panic! (the ''impossible'' happened)',
141     \      '  (GHC version 8.10.3:',
142     \      '    src/SizedTypes/List.hs:(46,19)-(50,0) Specified type does not refine Haskell type for `SizedTypes.List.out` (Plugged Init types new)',
143     \      '                                      The Liquid type',
144     \      '                                      .',
145     \      '                                          GHC.Types.Int -> (SizedTypes.List.List a) -> (_, (SizedTypes.List.List a))',
146     \      '                                      .',
147     \      '                                      is inconsistent with the Haskell type',
148     \      '                                      .',
149     \      '                                          forall p a ->',
150     \      'p -> SizedTypes.List.List a -> (a, SizedTypes.List.List a)',
151     \      '                                      .',
152     \      '                                      defined at src/SizedTypes/List.hs:52:1-3',
153     \      '                                      .',
154     \      '                                      Specifically, the Liquid component',
155     \      '                                      .',
156     \      '                                          {VV##0 : GHC.Types.Int | VV##0 >= 0}',
157     \      '                                      .',
158     \      '                                      is inconsistent with the Haskell component',
159     \      '                                      .',
160     \      '                                          p',
161     \      '                                      .',
162     \      '                                      ',
163     \      '                                      HINT: Use the hole ''_'' instead of the mismatched component (in the Liquid specification)',
164     \      '',
165     \      'Please report this as a GHC bug:  https://www.haskell.org/ghc/reportabug',
166     \      '',
167     \      ''
168   \ ]
169   AssertEqual
170   \ [
171   \   {
172   \     'lnum': 1,
173   \     'col': 1,
174   \     'type': 'E',
175   \     'text': 'ghc panic!',
176   \     'detail': join(g:detail[1:-3], "\n"),
177   \   },
178   \ ],
179   \ ale#handlers#haskell#HandleGHCFormat(bufnr(''), g:detail)
180   unlet g:detail