Browse files

make generation more permgen-safe

  • Loading branch information...
1 parent 7b544ec commit 5c2b5e22b81001c489dbf1c2794756a664c442ba @stuarthalloway stuarthalloway committed Feb 10, 2013
View
5 test/clojure/test_clojure/data_structures.clj
@@ -11,7 +11,8 @@
(ns clojure.test-clojure.data-structures
(:use clojure.test
- [clojure.test.generative :exclude (is)]))
+ [clojure.test.generative :exclude (is)])
+ (:require [clojure.test-clojure.generators :as cgen]))
;; *** Helper functions ***
@@ -23,7 +24,7 @@
;; *** Generative ***
(defspec subcollection-counts-are-consistent
identity
- [^collection coll]
+ [^{:tag cgen/ednable-collection} coll]
(let [n (count coll)]
(dotimes [i n]
(is (= n
View
11 test/clojure/test_clojure/generators.clj
@@ -70,14 +70,23 @@
[]
(gen/rand-nth @keyword-pool))
+(def symbol-pool
+ (delay
+ (binding [gen/*rnd* (java.util.Random. 42)]
+ (into [] (repeatedly 1000 gen/symbol)))))
+
+(defn symbol-from-pool
+ []
+ (gen/rand-nth @keyword-pool))
+
(def ednable-scalars
[(constantly nil)
gen/byte
gen/long
gen/boolean
gen/printable-ascii-char
gen/string
- gen/symbol
+ symbol-from-pool
keyword-from-pool
gen/uuid
gen/date
View
2 test/clojure/test_clojure/reader.clj
@@ -599,7 +599,7 @@
(defspec types-that-should-roundtrip
roundtrip
- [^anything o]
+ [^{:tag cgen/ednable} o]
(when-not (= o %)
(throw (ex-info "Value cannot roundtrip, see ex-data" {:printed o :read %}))))

0 comments on commit 5c2b5e2

Please sign in to comment.