Skip to content

Commit e279bdd

Browse files
committed
Add indentation tests for control flow and body-0 forms
Test if, if-not, case, when, when-not, when-first, while (spec 1), and do, delay, future, comment (spec 0).
1 parent 6c7ece9 commit e279bdd

1 file changed

Lines changed: 62 additions & 0 deletions

File tree

test/clojure-mode-indentation-test.el

Lines changed: 62 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -647,6 +647,68 @@ DESCRIPTION is a string with the description of the spec."
647647
(bound-fn [x]
648648
(inc x))")
649649

650+
(when-indenting-it "should handle if"
651+
"
652+
(if (even? x)
653+
(inc x)
654+
(dec x))")
655+
656+
(when-indenting-it "should handle if-not"
657+
"
658+
(if-not (nil? x)
659+
(use x)
660+
(default))")
661+
662+
(when-indenting-it "should handle case"
663+
"
664+
(case x
665+
:a 1
666+
:b 2
667+
3)")
668+
669+
(when-indenting-it "should handle when"
670+
"
671+
(when (pos? x)
672+
(println x)
673+
(inc x))")
674+
675+
(when-indenting-it "should handle when-not"
676+
"
677+
(when-not (nil? x)
678+
(println x))")
679+
680+
(when-indenting-it "should handle when-first"
681+
"
682+
(when-first [x xs]
683+
(println x))")
684+
685+
(when-indenting-it "should handle while"
686+
"
687+
(while (pos? @counter)
688+
(swap! counter dec))")
689+
690+
(when-indenting-it "should handle do"
691+
"
692+
(do
693+
(println 1)
694+
(println 2))")
695+
696+
(when-indenting-it "should handle delay"
697+
"
698+
(delay
699+
(expensive-computation))")
700+
701+
(when-indenting-it "should handle future"
702+
"
703+
(future
704+
(long-running-task))")
705+
706+
(when-indenting-it "should handle comment"
707+
"
708+
(comment
709+
(foo 1 2)
710+
(bar 3 4))")
711+
650712
(when-indenting-it "should handle reader conditionals"
651713
"#?@ (:clj []
652714
:cljs [])")

0 commit comments

Comments
 (0)