Skip to content
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
41 changes: 28 additions & 13 deletions tests/purescript-indentation-tests.el
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
(require 'purescript-mode)
(require 'purescript-indentation)

(defun purescript-test-indentation-expected-only (expected)
(with-temp-buffer
(insert expected)
(purescript-mode)
(turn-on-purescript-indentation)
(indent-region (point-min) (point-max))
(should (string= expected (buffer-string)))))

(defun purescript-test-indentation (before after &optional start-line)
(with-temp-buffer
(insert before)
Expand Down Expand Up @@ -210,15 +218,11 @@ type MyRec = { data :: Number

(ert-deftest func-with-do ()
:expected-result :failed
(purescript-test-indentation "
(purescript-test-indentation-expected-only "
foo :: Foo
foo = do
pure unit"

"
foo :: Foo
foo = do
pure unit"))
pure unit
"))

(ert-deftest do-bindings ()
:expected-result :failed
Expand Down Expand Up @@ -267,14 +271,25 @@ test3 a
(ert-deftest comma-first-list-after-case-of ()
"A comma-first list was getting misindented if goes after case-of"
:expected-result :failed
(purescript-test-indentation "
(purescript-test-indentation-expected-only "
fun = case _ of
[ a
, b ]
"
"))

"
fun = case _ of
[ a
, b ]
(ert-deftest multiline-func-decl-arrow-first ()
(purescript-test-indentation-expected-only "
foo ::
∀ a. A
-> B
-> C
"))

(ert-deftest multiline-func-decl-arrow-last ()
(purescript-test-indentation-expected-only "
foo ::
∀ a.
A ->
B ->
C
"))