From 63e2c4878119fd1a6ced619cd9d0900f532a8ce3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Reu=C3=9Fe?= Date: Thu, 11 Jun 2015 16:34:48 +0200 Subject: [PATCH 1/2] Add UnicodeSyntax versions of applicable test cases. --- tests/haskell-indentation-tests.el | 89 ++++++++++++++++++++++++++++++ 1 file changed, 89 insertions(+) diff --git a/tests/haskell-indentation-tests.el b/tests/haskell-indentation-tests.el index 89cc212be..bfa332f17 100644 --- a/tests/haskell-indentation-tests.el +++ b/tests/haskell-indentation-tests.el @@ -58,6 +58,14 @@ Example of lines: " z" "^ ^ ^")) +(ert-deftest haskell-indentation-check-2-unicode () + "Handle underscore in identifiers (unicode)" + (haskell-indentation-check + "function = do" + " (_x) ← return ()" + " z" + "^ ^ ^")) + (ert-deftest haskell-indentation-check-2a () "Handle apostrophe in identifiers" (haskell-indentation-check @@ -66,6 +74,13 @@ Example of lines: " z" "^ ^ ^")) +(ert-deftest haskell-indentation-check-2a-unicode () + "Handle apostrophe in identifiers (unicode)" + (haskell-indentation-check + "function = do" + " (_'x') ← return ()" + " z" + "^ ^ ^")) (ert-deftest haskell-indentation-check-3 () "Import statememnt symbol list 1" @@ -108,6 +123,16 @@ Example of lines: " , f <- fx x y c ]" " ^")) +(ert-deftest haskell-indentation-check-6-unicode () + "let in list comprehension (unicode)" + :expected-result :failed + (haskell-indentation-check + "fun = [ f | x ← xs" + " , y ← ys" + " , let c = 123" + " , f ← fx x y c ]" + " ^")) + (ert-deftest haskell-indentation-check-7 () "import after import" :expected-result :failed @@ -147,6 +172,14 @@ Example of lines: " , Just val2 <- lookup env var2" " ^")) +(ert-deftest haskell-indentation-check-11-unicode () + "Guards with commas (unicode)" + (haskell-indentation-check + "clunky env var1 var2" + " | Just val1 ← lookup env var1" + " , Just val2 ← lookup env var2" + " ^")) + (ert-deftest haskell-indentation-check-12 () "Guards with commas" :expected-result :failed @@ -189,6 +222,13 @@ Example of lines: "fun = \x -> do" " ^")) +(ert-deftest haskell-indentation-check-16-unicode () + "Lambda and a do block (unicode)" + :expected-result :failed + (haskell-indentation-check + "fun = \x → do" + " ^")) + (ert-deftest haskell-indentation-check-16a () "A lambda" :expected-result :failed @@ -196,6 +236,13 @@ Example of lines: "fun = \x ->" " ^")) +(ert-deftest haskell-indentation-check-16a-unicode () + "A lambda (unicode)" + :expected-result :failed + (haskell-indentation-check + "fun = \x →" + " ^")) + (ert-deftest haskell-indentation-check-17a () "A type for a function" :expected-result :failed @@ -212,6 +259,14 @@ Example of lines: " => Int" " ^")) +(ert-deftest haskell-indentation-check-17b-unicode () + "A type for a function with context (unicode)" + :expected-result :failed + (haskell-indentation-check + "fun ∷ Monad m" + " ⇒ Int" + " ^")) + (ert-deftest haskell-indentation-check-17c () "A type for a function with complicated context" :expected-result :failed @@ -220,6 +275,14 @@ Example of lines: " => MyMonad (A v) m" " ^")) +(ert-deftest haskell-indentation-check-17c-unicode () + "A type for a function with complicated context (unicode)" + :expected-result :failed + (haskell-indentation-check + "fun ∷ (Monad m, MonadBaseControl IO m, MyMonad (A v) m)" + " ⇒ MyMonad (A v) m" + " ^")) + (ert-deftest haskell-indentation-check-17d () "A type for a function with param and a complicated context" :expected-result :failed @@ -229,6 +292,15 @@ Example of lines: " -> m (Maybe a)" " ^")) +(ert-deftest haskell-indentation-check-17d-unicode () + "A type for a function with param and a complicated context (unicode)" + :expected-result :failed + (haskell-indentation-check + "fun ∷ (Monad m, MonadBaseControl IO m, MyMonad (A v) m)" + " ⇒ MyMonad (A v) m" + " → m (Maybe a)" + " ^")) + (ert-deftest haskell-indentation-check-18a () "if then else indentation: then" (haskell-indentation-check @@ -321,6 +393,13 @@ Example of lines: " c = undefined" " ^")) +(ert-deftest haskell-indentation-check-instance-20b-unicode () + "instance declaration (unicode)" + (haskell-indentation-check + "instance (Monad m) ⇒ C m a where" + " c = undefined" + " ^")) + (ert-deftest haskell-indentation-check-instance-21a () "layout versus comma in braces" (haskell-indentation-check @@ -330,3 +409,13 @@ Example of lines: " bar = 0" " , baz = 0" " ^")) + +(ert-deftest haskell-indentation-check-instance-21a-unicode () + "layout versus comma in braces (unicode)" + (haskell-indentation-check + "main ∷ IO ()" + "main = do" + "let foo = Foo {" + " bar = 0" + " , baz = 0" + " ^")) From 7290d4452c089499d2b3cd4977d199e18b15191f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebastian=20Reu=C3=9Fe?= Date: Thu, 11 Jun 2015 16:36:22 +0200 Subject: [PATCH 2/2] Ignore currently failing Unicode test cases for now. --- tests/haskell-indentation-tests.el | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tests/haskell-indentation-tests.el b/tests/haskell-indentation-tests.el index bfa332f17..85e11508c 100644 --- a/tests/haskell-indentation-tests.el +++ b/tests/haskell-indentation-tests.el @@ -59,6 +59,7 @@ Example of lines: "^ ^ ^")) (ert-deftest haskell-indentation-check-2-unicode () + :expected-result :failed "Handle underscore in identifiers (unicode)" (haskell-indentation-check "function = do" @@ -76,6 +77,7 @@ Example of lines: (ert-deftest haskell-indentation-check-2a-unicode () "Handle apostrophe in identifiers (unicode)" + :expected-result :failed (haskell-indentation-check "function = do" " (_'x') ← return ()" @@ -173,6 +175,7 @@ Example of lines: " ^")) (ert-deftest haskell-indentation-check-11-unicode () + :expected-result :failed "Guards with commas (unicode)" (haskell-indentation-check "clunky env var1 var2"