Skip to content

Commit 63e2c48

Browse files
author
Sebastian Reuße
committed
Add UnicodeSyntax versions of applicable test cases.
1 parent e53d09f commit 63e2c48

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

tests/haskell-indentation-tests.el

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,14 @@ Example of lines:
5858
" z"
5959
"^ ^ ^"))
6060

61+
(ert-deftest haskell-indentation-check-2-unicode ()
62+
"Handle underscore in identifiers (unicode)"
63+
(haskell-indentation-check
64+
"function = do"
65+
" (_x) ← return ()"
66+
" z"
67+
"^ ^ ^"))
68+
6169
(ert-deftest haskell-indentation-check-2a ()
6270
"Handle apostrophe in identifiers"
6371
(haskell-indentation-check
@@ -66,6 +74,13 @@ Example of lines:
6674
" z"
6775
"^ ^ ^"))
6876

77+
(ert-deftest haskell-indentation-check-2a-unicode ()
78+
"Handle apostrophe in identifiers (unicode)"
79+
(haskell-indentation-check
80+
"function = do"
81+
" (_'x') ← return ()"
82+
" z"
83+
"^ ^ ^"))
6984

7085
(ert-deftest haskell-indentation-check-3 ()
7186
"Import statememnt symbol list 1"
@@ -108,6 +123,16 @@ Example of lines:
108123
" , f <- fx x y c ]"
109124
" ^"))
110125

126+
(ert-deftest haskell-indentation-check-6-unicode ()
127+
"let in list comprehension (unicode)"
128+
:expected-result :failed
129+
(haskell-indentation-check
130+
"fun = [ f | x ← xs"
131+
" , y ← ys"
132+
" , let c = 123"
133+
" , f ← fx x y c ]"
134+
" ^"))
135+
111136
(ert-deftest haskell-indentation-check-7 ()
112137
"import after import"
113138
:expected-result :failed
@@ -147,6 +172,14 @@ Example of lines:
147172
" , Just val2 <- lookup env var2"
148173
" ^"))
149174

175+
(ert-deftest haskell-indentation-check-11-unicode ()
176+
"Guards with commas (unicode)"
177+
(haskell-indentation-check
178+
"clunky env var1 var2"
179+
" | Just val1 ← lookup env var1"
180+
" , Just val2 ← lookup env var2"
181+
" ^"))
182+
150183
(ert-deftest haskell-indentation-check-12 ()
151184
"Guards with commas"
152185
:expected-result :failed
@@ -189,13 +222,27 @@ Example of lines:
189222
"fun = \x -> do"
190223
" ^"))
191224

225+
(ert-deftest haskell-indentation-check-16-unicode ()
226+
"Lambda and a do block (unicode)"
227+
:expected-result :failed
228+
(haskell-indentation-check
229+
"fun = \x → do"
230+
" ^"))
231+
192232
(ert-deftest haskell-indentation-check-16a ()
193233
"A lambda"
194234
:expected-result :failed
195235
(haskell-indentation-check
196236
"fun = \x ->"
197237
" ^"))
198238

239+
(ert-deftest haskell-indentation-check-16a-unicode ()
240+
"A lambda (unicode)"
241+
:expected-result :failed
242+
(haskell-indentation-check
243+
"fun = \x"
244+
" ^"))
245+
199246
(ert-deftest haskell-indentation-check-17a ()
200247
"A type for a function"
201248
:expected-result :failed
@@ -212,6 +259,14 @@ Example of lines:
212259
" => Int"
213260
" ^"))
214261

262+
(ert-deftest haskell-indentation-check-17b-unicode ()
263+
"A type for a function with context (unicode)"
264+
:expected-result :failed
265+
(haskell-indentation-check
266+
"fun ∷ Monad m"
267+
" ⇒ Int"
268+
" ^"))
269+
215270
(ert-deftest haskell-indentation-check-17c ()
216271
"A type for a function with complicated context"
217272
:expected-result :failed
@@ -220,6 +275,14 @@ Example of lines:
220275
" => MyMonad (A v) m"
221276
" ^"))
222277

278+
(ert-deftest haskell-indentation-check-17c-unicode ()
279+
"A type for a function with complicated context (unicode)"
280+
:expected-result :failed
281+
(haskell-indentation-check
282+
"fun ∷ (Monad m, MonadBaseControl IO m, MyMonad (A v) m)"
283+
" ⇒ MyMonad (A v) m"
284+
" ^"))
285+
223286
(ert-deftest haskell-indentation-check-17d ()
224287
"A type for a function with param and a complicated context"
225288
:expected-result :failed
@@ -229,6 +292,15 @@ Example of lines:
229292
" -> m (Maybe a)"
230293
" ^"))
231294

295+
(ert-deftest haskell-indentation-check-17d-unicode ()
296+
"A type for a function with param and a complicated context (unicode)"
297+
:expected-result :failed
298+
(haskell-indentation-check
299+
"fun ∷ (Monad m, MonadBaseControl IO m, MyMonad (A v) m)"
300+
" ⇒ MyMonad (A v) m"
301+
" → m (Maybe a)"
302+
" ^"))
303+
232304
(ert-deftest haskell-indentation-check-18a ()
233305
"if then else indentation: then"
234306
(haskell-indentation-check
@@ -321,6 +393,13 @@ Example of lines:
321393
" c = undefined"
322394
" ^"))
323395

396+
(ert-deftest haskell-indentation-check-instance-20b-unicode ()
397+
"instance declaration (unicode)"
398+
(haskell-indentation-check
399+
"instance (Monad m) ⇒ C m a where"
400+
" c = undefined"
401+
" ^"))
402+
324403
(ert-deftest haskell-indentation-check-instance-21a ()
325404
"layout versus comma in braces"
326405
(haskell-indentation-check
@@ -330,3 +409,13 @@ Example of lines:
330409
" bar = 0"
331410
" , baz = 0"
332411
" ^"))
412+
413+
(ert-deftest haskell-indentation-check-instance-21a-unicode ()
414+
"layout versus comma in braces (unicode)"
415+
(haskell-indentation-check
416+
"main ∷ IO ()"
417+
"main = do"
418+
"let foo = Foo {"
419+
" bar = 0"
420+
" , baz = 0"
421+
" ^"))

0 commit comments

Comments
 (0)