Skip to content

Test suite: Do checks on UnicodeSyntax, too. #716

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jun 11, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions tests/haskell-indentation-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,15 @@ Example of lines:
" z"
"^ ^ ^"))

(ert-deftest haskell-indentation-check-2-unicode ()
:expected-result :failed
"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
Expand All @@ -66,6 +75,14 @@ Example of lines:
" z"
"^ ^ ^"))

(ert-deftest haskell-indentation-check-2a-unicode ()
"Handle apostrophe in identifiers (unicode)"
:expected-result :failed
(haskell-indentation-check
"function = do"
" (_'x') ← return ()"
" z"
"^ ^ ^"))

(ert-deftest haskell-indentation-check-3 ()
"Import statememnt symbol list 1"
Expand Down Expand Up @@ -108,6 +125,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
Expand Down Expand Up @@ -147,6 +174,15 @@ Example of lines:
" , Just val2 <- lookup env var2"
" ^"))

(ert-deftest haskell-indentation-check-11-unicode ()
:expected-result :failed
"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
Expand Down Expand Up @@ -189,13 +225,27 @@ 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
(haskell-indentation-check
"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
Expand All @@ -212,6 +262,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
Expand All @@ -220,6 +278,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
Expand All @@ -229,6 +295,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
Expand Down Expand Up @@ -321,6 +396,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
Expand All @@ -330,3 +412,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"
" ^"))