Hi folks,
Just committed (on Google code) some new features to
clojure.contrib.test-is:

* failure reports include source file and line number when possible

* Experimental: (are ...) uses clojure.contrib.template.  The old
each= is now "(are (= _1 _2) ...)".  The old all-true is now "(are
_ ...)"

* Experimental: tests created with deftest are functions, and can be
composed.  This is like the test framework in "Practical Common Lisp."

Let me know what you think, especially you people who are using this
for things like test-clojure.

Here are examples of the fun new things you can do:

(ns my-tests
    (:use clojure.contrib.test-is))

(deftest adding
  (are (= (+ _1 _2) _3)  ; this is a template
       1 1 2,
       2 2 5,  ; deliberate mistake
       3 5 8,
       1 -5 -4))

(deftest subtracting
  (are (= (- _1 _2) _3)
       5 1 4
       0 5 -5
       1 4 -3))

(deftest arithmetic
  (adding)
  (subtracting))

;; to make run-tests work correctly with nested tests, it needs a
hook:
(defn test-ns-hook []
  (arithmetic))

;;;;; an the results:
user=> (clojure.contrib.test-is/run-tests 'testing)

Testing testing

FAIL in (arithmetic adding) (testing.clj:4)
expected: (= (+ 2 2) 5)
  actual: (not= 4 5)

Ran 3 tests containing 7 assertions.
1 failures, 0 errors.

-Stuart Sierra
--~--~---------~--~----~------------~-------~--~----~
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
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