diff options
Diffstat (limited to 'src/clojure')
-rw-r--r-- | src/clojure/contrib/test_is.clj | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/clojure/contrib/test_is.clj b/src/clojure/contrib/test_is.clj index f649467f..dde7a410 100644 --- a/src/clojure/contrib/test_is.clj +++ b/src/clojure/contrib/test_is.clj @@ -282,6 +282,18 @@ `(alter-meta! (var ~name) assoc :test (fn [] ~@body)))) +(defmacro with-test + "Experimental. + 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." + [definition & body] + (if *load-tests* + `(doto ~definition (alter-meta! assoc :test (fn [] ~@body))) + definition)) + ;;; RUNNING TESTS (defn test-var |