在 clojure.test 中是否有等效的 Midje 事实形式



Midje 中的(facts ...)形式,让我们将一堆(fact ..)形式分组,并在它下面有更多的(facts ..)形式。

在 clojure.test 中编写相应的测试套件时,应该使用什么来替换,(facts ...)?在 clojure 中还有其他具有类似语义的东西吗?

您可以使用

testing对测试进行分组。链接文档页面中的释义示例:

(deftest arithmetic
  (testing "with positive integers"
    (is (= 4 (+ 2 2)))
    (is (= 7 (+ 3 4))))
  (testing "with negative integers"
    (is (= -4 (+ -2 -2)))
    (is (= -1 (+ 3 -4)))))

最新更新