Midje is a test framework for Clojure. I created it to support top-down as well
as bottom-up testing, to encourage readable tests, to provide a smooth
migration path from clojure.test, and to support a balance between abstraction
and concreteness.
Midje's tests look like the sort of examples shown in books like /The Joy of
Clojure/. Here's the second example from page 97 of that book:
(clojure.set/difference #{1 2 3 4} #{3 4 5 6})
;=> #{1 2}
Here's the same thing, in Midje:
(fact
(clojure.set/difference #{1 2 3 4} #{3 4 5 6})
=> #{1 2})
The 1.1 release of Midje is now out. This release is mostly about small touches
to improve ease-of-use. For example, syntax errors are beginning to be handled
more graciously, and line numbers are guessed better for some peculiar cases.
Also:
You can now more clearly express what must not be true:
(fact (+ 1 1) =not=> odd?)
https://github.com/marick/Midje/wiki/Negating-arrows
You can now mark pending facts in one more way. In addition to:
(future-fact
(sqrt 4) => 2
(sqrt -1) => i)
You can mark individual checks:
(fact
(sqrt 4) => 2
(sqrt -1) =future=> i)
https://github.com/marick/Midje/wiki/Future-facts
Midje allows you to have facts about one function depend upon facts about an
as-yet-unwritten function:
(fact (f 1) => 33
(provided (g 1) => 22))
The `provided` clause can now contain complicated function calls like this:
(fact (f 1) => 33
(provided (g (h 1) 3 (h (i (h 1)))) => 22)
https://github.com/marick/Midje/wiki/Folded-prerequisites
There's a shorthand for cases where you want a depended-upon function to return
different values each time it's called:
(fact (severity input) => :high
(provided (error-count) =streams=> (range)))
https://github.com/marick/Midje/wiki/Using-stateful-functions-as-prerequisites
-----
Brian Marick, Artisanal Labrador
Contract programming in Ruby and Clojure
Author of /Ring/ (forthcoming; sample: http://exampler.com/tmp/ring.pdf)
www.exampler.com, www.exampler.com/blog, www.twitter.com/marick
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en