Skip to content

Commit 6e773a2

Browse files
committed
Add indentation tests for as->, with-* fallback, and def* fallback
Test the as-> form (spec 2) and two implicit indentation behaviors in clojure-indent-function: - with-* forms get body-style indentation even without explicit indent specs (e.g., with-custom-thing) - Unknown def* forms (defwhatever, ns/defwhatever) also get body-style indentation via the fallback regex match
1 parent 920045f commit 6e773a2

1 file changed

Lines changed: 30 additions & 0 deletions

File tree

test/clojure-mode-indentation-test.el

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -566,6 +566,36 @@ DESCRIPTION is a string with the description of the spec."
566566
(finally
567567
(cleanup)))")
568568

569+
(when-indenting-it "should handle as->"
570+
"
571+
(as-> x $
572+
(inc $)
573+
(* $ 2))")
574+
575+
(when-indenting-it "should indent with-* forms like body even without explicit specs"
576+
"
577+
(with-open [f (io/reader \"x\")]
578+
(slurp f))"
579+
580+
"
581+
(with-redefs [foo bar]
582+
(test-stuff))"
583+
584+
"
585+
(with-custom-thing [x y]
586+
(body x y))")
587+
588+
(when-indenting-it "should indent unknown def forms like body"
589+
"
590+
(defwhatever my-thing
591+
:some-option true
592+
:another false)"
593+
594+
"
595+
(my.ns/defwhatever my-thing
596+
:some-option true
597+
:another false)")
598+
569599
(when-indenting-it "should handle reader conditionals"
570600
"#?@ (:clj []
571601
:cljs [])")

0 commit comments

Comments
 (0)