使用测试宏对相关测试进行分组
你可以使用 testing
宏在上下文中对 deftest
单元测试中的相关断言进行分组:
(deftest add-nums
(testing "Positive cases"
(is (= 2 (+ 1 1)))
(is (= 4 (+ 2 2))))
(testing "Negative cases"
(is (= -1 (+ 2 -3)))
(is (= -4 (+ 8 -12)))))
这有助于在运行时澄清测试输出。请注意,testing
必须出现在 deftest
内。