Skip to content

Commit

Permalink
Since one-case is specialized to semi-sweet, added a more general after.
Browse files Browse the repository at this point in the history
  • Loading branch information
marick committed Jul 27, 2010
1 parent c9810cb commit 2c74e75
Showing 1 changed file with 18 additions and 5 deletions.
23 changes: 18 additions & 5 deletions test/midje/test_util.clj
Expand Up @@ -10,6 +10,14 @@

(def reported (atom []))

(defn run-and-check [run-form check-forms]
`(do
(binding [report (fn [report-map#] (swap! reported conj report-map#))]
(reset! reported [])
~run-form)
~@check-forms))


(defmacro one-case
([description]
`(println "PENDING:" ~description))
Expand All @@ -18,11 +26,15 @@
(= (first form) 'expect)))]
(assert (form-is-expect? expect-form))
(assert (every? #(not (form-is-expect? %)) check-forms))
`(do
(binding [report (fn [report-map#] (swap! reported conj report-map#))]
(reset! reported [])
~expect-form)
~@check-forms))))
(run-and-check expect-form check-forms))))


(defmacro after
([description]
`(println "PENDING:" ~description))
([example-form & check-forms]
(run-and-check example-form check-forms)))


(defn last-type? [expected]
(= (:type (last (deref reported))) expected))
Expand All @@ -32,3 +44,4 @@
(= 1 (count (deref reported))))

(defn raw-report [] (println @reported))

0 comments on commit 2c74e75

Please sign in to comment.