1.2.0 permalink Arrow_down_16x16
  • (with-test definition & body)
Takes any definition form (that returns a Var) as the first argument.
Remaining body goes in the :test metadata function for that Var.

When *load-tests* is false, only evaluates the definition, ignoring
the tests.

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/test.clj:580 top

(defmacro with-test
  "Takes any definition form (that returns a Var) as the first argument.
  Remaining body goes in the :test metadata function for that Var.

  When *load-tests* is false, only evaluates the definition, ignoring
  the tests."
  {:added "1.1"}
  [definition & body]
  (if *load-tests*
    `(doto ~definition (alter-meta! assoc :test (fn [] ~@body)))
    definition))
Vars in clojure.contrib.test-is/with-test: defmacro alter-meta! apply assoc concat doto fn list seq vector
Used in 0 other vars

Comments top

No comments for with-test. Log in to add a comment.