• (has-args arg-pred-forms)
  • (has-args arg-pred-forms expect-hash-form)
Creates or associates to an existing expectation hash the :has-args key with
a value corresponding to a function that will either return true if its
argument expectations are met or throw an exception with the details of the
first failed argument it encounters.
Only specify as many predicates as you are interested in verifying. The rest
of the values are safely ignored.
Usage:
(has-args [arg-pred-1 arg-pred-2 ... arg-pred-n] expectation-hash?)

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source clojure/contrib/mock.clj:228 top

(defmacro has-args
  "Creates or associates to an existing expectation hash the :has-args key with
a value corresponding to a function that will either return true if its
argument expectations are met or throw an exception with the details of the
first failed argument it encounters.
Only specify as many predicates as you are interested in verifying. The rest
of the values are safely ignored.
Usage:
(has-args [arg-pred-1 arg-pred-2 ... arg-pred-n] expectation-hash?)"

  ([arg-pred-forms] `(has-args ~arg-pred-forms {}))
  ([arg-pred-forms expect-hash-form]
    (assert-args has-args
      (vector? arg-pred-forms) "a vector of argument predicates")
    `(assoc ~expect-hash-form :has-args
       (make-arg-checker ~arg-pred-forms '~arg-pred-forms))))
Vars in clojure.contrib.mock.test-adapter/has-args: defmacro vector? apply assoc concat hash-map list seq
Used in 0 other vars

Comments top

No comments for has-args. Log in to add a comment.