Skip to content
This repository has been archived by the owner on Nov 9, 2017. It is now read-only.

Commit

Permalink
Add deftest
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuart Sierra committed Dec 4, 2010
1 parent 89ee8cb commit 6b13942
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions modules/lazytest/src/main/clojure/lazytest/deftest.clj
@@ -0,0 +1,20 @@
(ns lazytest.deftest
(:use lazytest.expect
lazytest.test-case))

(def ^:dynamic *testing* nil)

(defmacro testing [doc & body]
`(binding [*testing* (cons ~doc *testing*)]
~@body))

(defmacro is
([expr]
`(expect nil ~expr))
([expr message]
`(expect ~message ~expr)))

(defmacro deftest [sym & body]
{:pre [(symbol? sym)]}
`(def ~sym (vary-meta (test-case (fn [] ~@body))
assoc :name '~sym)))

0 comments on commit 6b13942

Please sign in to comment.