diff --git a/src/midje/ideas/formulas.clj b/src/midje/ideas/formulas.clj index 6e4ab9967..9a0260c21 100644 --- a/src/midje/ideas/formulas.clj +++ b/src/midje/ideas/formulas.clj @@ -1,5 +1,9 @@ (ns midje.ideas.formulas (:use [utilize.macro :only [macro-for]])) + +(def formula-run-bindings (atom {})) + +;; add all of this to midje.sweet (def #^:dynamic *num-generations* 100) @@ -10,9 +14,12 @@ `(do (macro-for [_# (range (dec *num-generations*))] (let ~bindings + ;; must I force the bindings to not use destructuring? + ;; take left side of each binding, and its matching value and (reset! formula-run-bindings formula-binding-map) (midje.sweet/fact ~docstring? ~@body :formula :formula-in-progress ))) - (let ~bindings + (let ~bindings + ;; ditto (midje.sweet/fact ~docstring? ~@body :formula :formula-conclude ))))) diff --git a/src/midje/unprocessed.clj b/src/midje/unprocessed.clj index 29ea89687..1ec7d94fd 100644 --- a/src/midje/unprocessed.clj +++ b/src/midje/unprocessed.clj @@ -15,6 +15,8 @@ [utilize.seq :only [find-first]])) (immigrate 'midje.checkers) +;; stick inside midje.ideas.formula + (def ^{:private true} formula-reports (atom [])) (defn ^{:private true} report-formula [report-map] @@ -27,6 +29,8 @@ (report {:type :pass}) ) (reset! formula-reports []))) +;;;;;; + (letfn [(fail [type actual call] {:type type :description (nested-fact-description)