2
這裏是傳遞的代碼版本:Midje對宏失敗Clojure中
正常功能:即通過
(defn my-fn
[]
(throw (IllegalStateException.)))
(fact
(my-fn) => (throws IllegalStateException))
這裏是它的宏版本:
(defmacro my-fn
[]
(throw (IllegalStateException.)))
(fact
(my-fn) => (throws IllegalStateException))
其中失敗這裏是輸出:
LOAD FAILURE for example.dsl.is-test
java.lang.IllegalStateException, compiling:(example/dsl/is_test.clj:14:3)
The exception has been stored in #'*me, so `(pst *me)` will show the stack trace.
FAILURE: 1 check failed. (But 12 succeeded.)
這是我剛換DEFN到defmacro相同的代碼。
我不明白爲什麼這不起作用?
非常感謝! –