Skip to content

Commit 3740612

Browse files
committed
Merge pull request #716 from eigengrau/unicode-indentation-checks
Test suite: Do checks on UnicodeSyntax, too.
2 parents e53d09f + 7290d44 commit 3740612

File tree

1 file changed

+92
-0
lines changed

1 file changed

+92
-0
lines changed

tests/haskell-indentation-tests.el

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

61+
(ert-deftest haskell-indentation-check-2-unicode ()
62+
:expected-result :failed
63+
"Handle underscore in identifiers (unicode)"
64+
(haskell-indentation-check
65+
"function = do"
66+
" (_x) ← return ()"
67+
" z"
68+
"^ ^ ^"))
69+
6170
(ert-deftest haskell-indentation-check-2a ()
6271
"Handle apostrophe in identifiers"
6372
(haskell-indentation-check
@@ -66,6 +75,14 @@ Example of lines:
6675
" z"
6776
"^ ^ ^"))
6877

78+
(ert-deftest haskell-indentation-check-2a-unicode ()
79+
"Handle apostrophe in identifiers (unicode)"
80+
:expected-result :failed
81+
(haskell-indentation-check
82+
"function = do"
83+
" (_'x') ← return ()"
84+
" z"
85+
"^ ^ ^"))
6986

7087
(ert-deftest haskell-indentation-check-3 ()
7188
"Import statememnt symbol list 1"
@@ -108,6 +125,16 @@ Example of lines:
108125
" , f <- fx x y c ]"
109126
" ^"))
110127

128+
(ert-deftest haskell-indentation-check-6-unicode ()
129+
"let in list comprehension (unicode)"
130+
:expected-result :failed
131+
(haskell-indentation-check
132+
"fun = [ f | x ← xs"
133+
" , y ← ys"
134+
" , let c = 123"
135+
" , f ← fx x y c ]"
136+
" ^"))
137+
111138
(ert-deftest haskell-indentation-check-7 ()
112139
"import after import"
113140
:expected-result :failed
@@ -147,6 +174,15 @@ Example of lines:
147174
" , Just val2 <- lookup env var2"
148175
" ^"))
149176

177+
(ert-deftest haskell-indentation-check-11-unicode ()
178+
:expected-result :failed
179+
"Guards with commas (unicode)"
180+
(haskell-indentation-check
181+
"clunky env var1 var2"
182+
" | Just val1 ← lookup env var1"
183+
" , Just val2 ← lookup env var2"
184+
" ^"))
185+
150186
(ert-deftest haskell-indentation-check-12 ()
151187
"Guards with commas"
152188
:expected-result :failed
@@ -189,13 +225,27 @@ Example of lines:
189225
"fun = \x -> do"
190226
" ^"))
191227

228+
(ert-deftest haskell-indentation-check-16-unicode ()
229+
"Lambda and a do block (unicode)"
230+
:expected-result :failed
231+
(haskell-indentation-check
232+
"fun = \x → do"
233+
" ^"))
234+
192235
(ert-deftest haskell-indentation-check-16a ()
193236
"A lambda"
194237
:expected-result :failed
195238
(haskell-indentation-check
196239
"fun = \x ->"
197240
" ^"))
198241

242+
(ert-deftest haskell-indentation-check-16a-unicode ()
243+
"A lambda (unicode)"
244+
:expected-result :failed
245+
(haskell-indentation-check
246+
"fun = \x"
247+
" ^"))
248+
199249
(ert-deftest haskell-indentation-check-17a ()
200250
"A type for a function"
201251
:expected-result :failed
@@ -212,6 +262,14 @@ Example of lines:
212262
" => Int"
213263
" ^"))
214264

265+
(ert-deftest haskell-indentation-check-17b-unicode ()
266+
"A type for a function with context (unicode)"
267+
:expected-result :failed
268+
(haskell-indentation-check
269+
"fun ∷ Monad m"
270+
" ⇒ Int"
271+
" ^"))
272+
215273
(ert-deftest haskell-indentation-check-17c ()
216274
"A type for a function with complicated context"
217275
:expected-result :failed
@@ -220,6 +278,14 @@ Example of lines:
220278
" => MyMonad (A v) m"
221279
" ^"))
222280

281+
(ert-deftest haskell-indentation-check-17c-unicode ()
282+
"A type for a function with complicated context (unicode)"
283+
:expected-result :failed
284+
(haskell-indentation-check
285+
"fun ∷ (Monad m, MonadBaseControl IO m, MyMonad (A v) m)"
286+
" ⇒ MyMonad (A v) m"
287+
" ^"))
288+
223289
(ert-deftest haskell-indentation-check-17d ()
224290
"A type for a function with param and a complicated context"
225291
:expected-result :failed
@@ -229,6 +295,15 @@ Example of lines:
229295
" -> m (Maybe a)"
230296
" ^"))
231297

298+
(ert-deftest haskell-indentation-check-17d-unicode ()
299+
"A type for a function with param and a complicated context (unicode)"
300+
:expected-result :failed
301+
(haskell-indentation-check
302+
"fun ∷ (Monad m, MonadBaseControl IO m, MyMonad (A v) m)"
303+
" ⇒ MyMonad (A v) m"
304+
" → m (Maybe a)"
305+
" ^"))
306+
232307
(ert-deftest haskell-indentation-check-18a ()
233308
"if then else indentation: then"
234309
(haskell-indentation-check
@@ -321,6 +396,13 @@ Example of lines:
321396
" c = undefined"
322397
" ^"))
323398

399+
(ert-deftest haskell-indentation-check-instance-20b-unicode ()
400+
"instance declaration (unicode)"
401+
(haskell-indentation-check
402+
"instance (Monad m) ⇒ C m a where"
403+
" c = undefined"
404+
" ^"))
405+
324406
(ert-deftest haskell-indentation-check-instance-21a ()
325407
"layout versus comma in braces"
326408
(haskell-indentation-check
@@ -330,3 +412,13 @@ Example of lines:
330412
" bar = 0"
331413
" , baz = 0"
332414
" ^"))
415+
416+
(ert-deftest haskell-indentation-check-instance-21a-unicode ()
417+
"layout versus comma in braces (unicode)"
418+
(haskell-indentation-check
419+
"main ∷ IO ()"
420+
"main = do"
421+
"let foo = Foo {"
422+
" bar = 0"
423+
" , baz = 0"
424+
" ^"))

0 commit comments

Comments
 (0)