Recently I sat through a presentation on Jim Weirich's ruby based
rspec-given.  I decided to see if it was possible to port it as a set
of macros over clojure.test.   Turns out that it was fairly easy to
port the concepts over to clojure.

Link:
https://github.com/ckirkendall/ClojureGiven

Basic Syntax:

(ns cljgiven.test.core
  (:use [cljgiven.core])
  (:use [clojure.test]))

(defspec basic-spec
  (Given [t1 (+ 1 x)
          t2 (- 2 t1)])           ;this is lazy
  (Given! [y 3])                  ;this is not
  (Context "let us test t1"
           (Given [x (+ 1 y)])    ;this is lazy
           (When result (+ 1 t1)) ;lazy Givens above evaluated now
           (Then (= 6 result)))
  (Context "let us test t2"
           (Given! [x (+ 1 3)])   ;not lazy
           (When result2 (+ t2 x))
           (Then (= 2 result2))))

-- 
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to clojure@googlegroups.com
Note that posts from new members are moderated - please be patient with your 
first post.
To unsubscribe from this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to