当我在Spacemacs中通过<SPC> m t t在Clojure模式下运行测试时,即使测试明显失败,它也不会显示失败。请参见:

1不等于2,但仍有0次测试失败。
如何才能使测试失败?
发布于 2016-08-10 12:07:00
您的测试中有一个问题:它缺少比较运算符。正确的版本是:
(deftest test-exercise-1-4
(testing "count-anywhere"
(is (= 2 1))))is宏具有以下定义(为简明起见,已编辑源代码):
(defmacro is
"Generic assertion macro. 'form' is any predicate test.
'msg' is an optional message to attach to the assertion.
Example: (is (= 4 (+ 2 2)) \"Two plus two should be 4\")
([form] `(is ~form nil))
([form msg] `(try-expr ~msg ~form)))正如您在(is 2 1)中看到的,您正在调用第二个are,其中form为2,用于断言的消息为1。因为2是真实的,所以它发出要传递的断言:
(is 2)
;; => 2
(is false)
FAIL in () (boot.user5045373352931487641.clj:1)
expected: false
actual: false
;; => falsehttps://stackoverflow.com/questions/38861703
复制相似问题