Skip to content

Commit f72578f

Browse files
committed
Add indentation tests for binding, iteration, and special-arg forms
Test binding, loop, for, doseq, dotimes, when-let, if-let, when-some, if-some, doto, locking, fdef, and this-as. All use spec 1 (one special arg before body).
1 parent e279bdd commit f72578f

1 file changed

Lines changed: 71 additions & 0 deletions

File tree

test/clojure-mode-indentation-test.el

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -709,6 +709,77 @@ DESCRIPTION is a string with the description of the spec."
709709
(foo 1 2)
710710
(bar 3 4))")
711711

712+
(when-indenting-it "should handle binding"
713+
"
714+
(binding [*out* writer]
715+
(println \"hello\"))")
716+
717+
(when-indenting-it "should handle loop"
718+
"
719+
(loop [i 0]
720+
(when (< i 10)
721+
(recur (inc i))))")
722+
723+
(when-indenting-it "should handle for"
724+
"
725+
(for [x (range 10)
726+
:when (even? x)]
727+
(* x x))")
728+
729+
(when-indenting-it "should handle doseq"
730+
"
731+
(doseq [x xs]
732+
(println x))")
733+
734+
(when-indenting-it "should handle dotimes"
735+
"
736+
(dotimes [i 10]
737+
(println i))")
738+
739+
(when-indenting-it "should handle when-let"
740+
"
741+
(when-let [x (foo)]
742+
(bar x))")
743+
744+
(when-indenting-it "should handle if-let"
745+
"
746+
(if-let [x (foo)]
747+
(bar x)
748+
(baz))")
749+
750+
(when-indenting-it "should handle when-some"
751+
"
752+
(when-some [x (foo)]
753+
(bar x))")
754+
755+
(when-indenting-it "should handle if-some"
756+
"
757+
(if-some [x (foo)]
758+
(bar x)
759+
(baz))")
760+
761+
(when-indenting-it "should handle doto"
762+
"
763+
(doto (java.util.HashMap.)
764+
(.put \"a\" 1)
765+
(.put \"b\" 2))")
766+
767+
(when-indenting-it "should handle locking"
768+
"
769+
(locking obj
770+
(alter-state! obj))")
771+
772+
(when-indenting-it "should handle fdef"
773+
"
774+
(fdef my-fn
775+
:args (s/cat :x int?)
776+
:ret int?)")
777+
778+
(when-indenting-it "should handle this-as"
779+
"
780+
(this-as self
781+
(.method self))")
782+
712783
(when-indenting-it "should handle reader conditionals"
713784
"#?@ (:clj []
714785
:cljs [])")

0 commit comments

Comments
 (0)