Permalink
Browse files

Fix CLJ-931: Syntactically broken clojure.test/are tests succeed.

Fixed a test case in test/clojure/test_clojure/java_interop.clj only
because of the bug in clojure.test/are CLJ-931 is about.

No test case added that causes clojure.test/are to fail, because could
not determine how to write one that didn't also cause the Clojure
build tests to fail.

Signed-off-by: Stuart Halloway <stu@thinkrelevance.com>
  • Loading branch information...
1 parent 14428c2 commit fa927fd942532fd1340d0e294a823e03c1ca9c89 @tsdh tsdh committed with stuarthalloway Feb 17, 2012
Showing with 17 additions and 9 deletions.
  1. +9 −1 src/clj/clojure/test.clj
  2. +8 −8 test/clojure/test_clojure/java_interop.clj
View
@@ -568,7 +568,15 @@
Note: This breaks some reporting features, such as line numbers."
{:added "1.1"}
[argv expr & args]
- `(temp/do-template ~argv (is ~expr) ~@args))
+ (if (or
+ ;; (are [] true) is meaningless but ok
+ (and (empty? argv) (empty? args))
+ ;; Catch wrong number of args
+ (and (pos? (count argv))
+ (pos? (count args))
+ (zero? (mod (count args) (count argv)))))
+ `(temp/do-template ~argv (is ~expr) ~@args)
+ (throw (IllegalArgumentException. "The number of args doesn't match are's argv."))))
(defmacro testing
"Adds a new string to the list of testing contexts. May be nested,
@@ -41,14 +41,14 @@
(. Math (abs -7)) )
; (. target -prop)
- (are [x y] (= x y)
- (let [p (java.awt.Point. 1 2)]
- 1 (.-x p)
- 2 (.-y p)
- 1 (. p -x)
- 2 (. p -y)
- 1 (. (java.awt.Point. 1 2) -x)
- 2 (. (java.awt.Point. 1 2) -y)))
+ (let [p (java.awt.Point. 1 2)]
+ (are [x y] (= x y)
+ 1 (.-x p)
+ 2 (.-y p)
+ 1 (. p -x)
+ 2 (. p -y)
+ 1 (. (java.awt.Point. 1 2) -x)
+ 2 (. (java.awt.Point. 1 2) -y)))
; Classname/staticField
(are [x] (= x 2147483647)

0 comments on commit fa927fd

Please sign in to comment.