Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Browse files

A little renaming

  • Loading branch information...
commit e1d4380acb40fdb614fda33a1f490ee6a78af2ce 1 parent 64a61c6
@marick authored
5 src/midje/data/prerequisite_state.clj
@@ -33,9 +33,8 @@
(= function-var (:var fake)))
(defmethod call-handled-by-fake? :default [function-var actual-args fake]
- (let [arg-matchers-fn (:arg-matchers fake)]
- (and (= function-var (:var fake))
- (arg-matchers-fn actual-args))))
+ (and (= function-var (:var fake))
+ ((:arglist-matcher fake) actual-args)))
(defn usable-default-function? [fake]
(when config/*allow-default-prerequisites*
6 src/midje/parsing/
@@ -88,11 +88,11 @@ maps are stored in `parsing/lexical_maps.clj`.
The lexical map shown above uses only core Clojure. Other
maps might not. For example, a `fake` map uses Midje
-functions to generate matching functions:
+functions to generate functions:
- {:arg-matchers (map mkfn:arg-matcher [1 (roughly 2)])
- :result-supplier (mkfn:result-supplier lexical-var)}
+ {:result-supplier (from-fake-maps/mkfn:result-supplier lexical-var)
+ :arglist-matcher (from-fake-maps/mkfn:arglist-matcher-fixed-arity ...)}
Such functions are defined in the `3_*` directory.
10 src/midje/parsing/lexical_maps.clj
@@ -64,11 +64,11 @@
;; A fake map describes all or part of a temporary rebinding of a var with a function that
;; captures invocations and also returns canned values.
-(defn- choose-mkfn-for-arglist-matcher [arg-matchers]
+(defn- choose-mkfn-for-arglist-matcher [arg-descriptions]
(letfn [(allows-optional-args? [args] (any? #(= % (symbol "&")) args))]
- (if (allows-optional-args? arg-matchers)
- `(from-fake-maps/mkfn:arglist-matcher-allowing-optional-args ~@arg-matchers)
- `(from-fake-maps/mkfn:arglist-matcher-fixed-arity ~@arg-matchers))))
+ (if (allows-optional-args? arg-descriptions)
+ `(from-fake-maps/mkfn:arglist-matcher-allowing-optional-args ~@arg-descriptions)
+ `(from-fake-maps/mkfn:arglist-matcher-fixed-arity ~@arg-descriptions))))
(defn fake [call-form fnref args arrow result overrides]
(let [source-details `{:call-form '~call-form
@@ -82,7 +82,7 @@
:var ~(fnref/as-var-form fnref)
:value-at-time-of-faking (if (bound? ~(fnref/as-var-form fnref))
~(fnref/as-form-to-fetch-var-value fnref))
- :arg-matchers ~(choose-mkfn-for-arglist-matcher args)
+ :arglist-matcher ~(choose-mkfn-for-arglist-matcher args)
:result-supplier (from-fake-maps/mkfn:result-supplier ~arrow ~result)
:times :default ; Default allows for a more attractive error in the most common case.

0 comments on commit e1d4380

Please sign in to comment.
Something went wrong with that request. Please try again.