Correctly format diff output when = is fully qualified.

This commit is contained in:
Paul Stadig 2015-11-28 15:58:11 -05:00
parent 7bb7cf9050
commit f4b2e226cb
2 changed files with 27 additions and 14 deletions

View file

@ -3,10 +3,8 @@
(:require [clojure.data :as data]
[clojure.pprint :as pp]))
(defonce activation-body
(delay
(when (not (System/getenv "INHUMANE_TEST_OUTPUT"))
(defmethod assert-expr '= [msg [_ a & more]]
(defn =-body
[msg a more]
`(let [a# ~a]
(if-let [more# (seq (list ~@more))]
(let [result# (apply = a# more#)]
@ -22,6 +20,14 @@
result#)
(throw (Exception. "= expects more than one argument")))))
(defonce activation-body
(delay
(when (not (System/getenv "INHUMANE_TEST_OUTPUT"))
(defmethod assert-expr '= [msg [_ a & more]]
(=-body msg a more))
(defmethod assert-expr 'clojure.core/= [msg [_ a & more]]
(=-body msg a more))
(defmethod report :fail
[{:keys [type expected actual diffs message] :as event}]
(with-test-out

View file

@ -17,3 +17,10 @@
(let [foo {:foo :bar :baz :quux :something "a long string?"
:another-key "and another value"}]
(is (list? foo)))))
(defmacro deftest+
[test-name expected actual]
`(deftest ~test-name
(is (= ~expected ~actual))))
(deftest+ t-macro-wrapping 1 2)