Skip to content

Commit 8dda6cb

Browse files
committed
tests: factor out indentation testing, where before == after
1 parent 23d99bf commit 8dda6cb

File tree

1 file changed

+12
-14
lines changed

1 file changed

+12
-14
lines changed

tests/purescript-indentation-tests.el

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,14 @@
2121
(require 'purescript-mode)
2222
(require 'purescript-indentation)
2323

24+
(defun purescript-test-indentation-expected-only (expected)
25+
(with-temp-buffer
26+
(insert expected)
27+
(purescript-mode)
28+
(turn-on-purescript-indentation)
29+
(indent-region (point-min) (point-max))
30+
(should (string= expected (buffer-string)))))
31+
2432
(defun purescript-test-indentation (before after &optional start-line)
2533
(with-temp-buffer
2634
(insert before)
@@ -210,15 +218,11 @@ type MyRec = { data :: Number
210218

211219
(ert-deftest func-with-do ()
212220
:expected-result :failed
213-
(purescript-test-indentation "
214-
foo :: Foo
215-
foo = do
216-
pure unit"
217-
218-
"
221+
(purescript-test-indentation-expected-only "
219222
foo :: Foo
220223
foo = do
221-
pure unit"))
224+
pure unit
225+
"))
222226

223227
(ert-deftest do-bindings ()
224228
:expected-result :failed
@@ -267,13 +271,7 @@ test3 a
267271
(ert-deftest comma-first-list-after-case-of ()
268272
"A comma-first list was getting misindented if goes after case-of"
269273
:expected-result :failed
270-
(purescript-test-indentation "
271-
fun = case _ of
272-
[ a
273-
, b ]
274-
"
275-
276-
"
274+
(purescript-test-indentation-expected-only "
277275
fun = case _ of
278276
[ a
279277
, b ]

0 commit comments

Comments
 (0)