Skip to content

Commit

Permalink
Fix CLJ-931: Syntactically broken clojure.test/are tests succeed.
Browse files Browse the repository at this point in the history
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
tsdh authored and stuarthalloway committed Mar 23, 2012
1 parent 14428c2 commit fa927fd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 9 deletions.
10 changes: 9 additions & 1 deletion src/clj/clojure/test.clj
Expand Up @@ -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,
Expand Down
16 changes: 8 additions & 8 deletions test/clojure/test_clojure/java_interop.clj
Expand Up @@ -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)
Expand Down

0 comments on commit fa927fd

Please sign in to comment.