Skip to content

Commit 3052427

Browse files
committed
Add indentation tests for clojure.test, core.logic, and core.async forms
Test library-specific indent specs: - clojure.test: testing (1), deftest (:defn), are (2), use-fixtures (:defn), async (1) - core.logic: run (:defn), run* (:defn), fresh (:defn) - core.async: go (0), go-loop (1), thread (0), alt! (0), alt!! (0)
1 parent f72578f commit 3052427

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

test/clojure-mode-indentation-test.el

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -780,6 +780,81 @@ DESCRIPTION is a string with the description of the spec."
780780
(this-as self
781781
(.method self))")
782782

783+
;; clojure.test
784+
(when-indenting-it "should handle testing"
785+
"
786+
(testing \"some feature\"
787+
(is (= 1 1)))")
788+
789+
(when-indenting-it "should handle deftest"
790+
"
791+
(deftest my-test
792+
(is (= 1 1)))")
793+
794+
(when-indenting-it "should handle are"
795+
"
796+
(are [x y] (= x y)
797+
1 1
798+
2 2)")
799+
800+
(when-indenting-it "should handle use-fixtures"
801+
"
802+
(use-fixtures :each
803+
my-fixture)")
804+
805+
(when-indenting-it "should handle async"
806+
"
807+
(async done
808+
(do-stuff)
809+
(done))")
810+
811+
;; core.logic
812+
(when-indenting-it "should handle run"
813+
"
814+
(run [q]
815+
(== q 1))")
816+
817+
(when-indenting-it "should handle run*"
818+
"
819+
(run* [q]
820+
(== q 1))")
821+
822+
(when-indenting-it "should handle fresh"
823+
"
824+
(fresh [a b]
825+
(== a 1)
826+
(== b 2))")
827+
828+
;; core.async
829+
(when-indenting-it "should handle go"
830+
"
831+
(go
832+
(<! ch)
833+
(println \"done\"))")
834+
835+
(when-indenting-it "should handle go-loop"
836+
"
837+
(go-loop [x 0]
838+
(>! ch x)
839+
(recur (inc x)))")
840+
841+
(when-indenting-it "should handle thread"
842+
"
843+
(thread
844+
(blocking-op))")
845+
846+
(when-indenting-it "should handle alt!"
847+
"
848+
(alt!
849+
ch1 ([v] (println v))
850+
ch2 ([v] (println v)))")
851+
852+
(when-indenting-it "should handle alt!!"
853+
"
854+
(alt!!
855+
ch1 ([v] (println v))
856+
ch2 ([v] (println v)))")
857+
783858
(when-indenting-it "should handle reader conditionals"
784859
"#?@ (:clj []
785860
:cljs [])")

0 commit comments

Comments
 (0)