考虑以下代码
(use 'midje.sweet)
(defn x2 [x] (* x x))
(def fs {:x2 x2})
(fact
(x2 1) => "one"
((:x2 fs) 1) => "one"
(against-background
(#'tweetfetcher.core-test/x2 1) => "one"))
哪个输出
FAIL at (core_test.clj:177)
Expected: "one"
Actual: 1
FAILURE: 1 check failed. (But 32 succeeded.)
第一次检查被存根,而第二次使用x2
由 hashmap 提供fs
。
考虑到我排除了引用,为什么 (:x2 fs)
不存根?
感谢您的见解。