Hello!
I found a bug caused by the recent transition from old test-is and
template. Old 'are' used to have a syntax for testing if things are
logically true:
(are _
true false nil)
This syntax is used in numbers.clj, see old version (search for "are
_"):
http://code.google.com/p/clojure-contrib/source/browse/trunk/src/clojure/contrib/test_clojure/numbers.clj
and functions
Coerced-Byte, Coerced-Short, ...
and test-even?, test-odd?.
If I change (even? 8) to (even? 1) in test-even? new tests will not
fail.
The reason is that new 'are' needs one more parameter:
OLD:
user=> (macroexpand-1 '(are _ true false nil))
(clojure.contrib.template/do-template (clojure.contrib.test-is/is _)
true false nil)
NEW:
user=> (macroexpand-1 '(are [x] true false nil))
(clojure.template/do-template [x] (clojure.test/is true) false nil)
Fix is to rewrite these tests by adding (true? x) or (if x true
false):
(deftest test-even?
(are [x] (true? x)
(even? -4)
(not (even? -3))
(even? 0)
(not (even? 5))
(even? 1))
(is (thrown? ArithmeticException (even? 1/2)))
(is (thrown? ArithmeticException (even? (double 10)))))
=>
[java] FAIL in (test-even?) (numbers.clj:373)
[java] expected: (true? (even? 1))
[java] actual: (not (true? false))
Thank you for your attention, Frantisek