aboutsummaryrefslogtreecommitdiff
path: root/src/clojure
diff options
context:
space:
mode:
authorStuart Sierra <mail@stuartsierra.com>2009-01-12 01:45:31 +0000
committerStuart Sierra <mail@stuartsierra.com>2009-01-12 01:45:31 +0000
commit6e53cf73c313d2bf76f5ee3c9a847548665b32e2 (patch)
treeea3b2d78255b8254228c45c565cf012d2e3d184e /src/clojure
parentd99887a0f17ea5103a8611f94ed1dadad4f40803 (diff)
test_is.clj: added "with-test"
Diffstat (limited to 'src/clojure')
-rw-r--r--src/clojure/contrib/test_is.clj12
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