Browse files

Test exception propagation out of r/fold CLJ-1058

Signed-off-by: Stuart Halloway <stu@cognitect.com>
  • Loading branch information...
1 parent 91dd867 commit 6c318f50803329d987a4fc05e1c3e779dc9a7a18 @bruceadams bruceadams committed with Stuart Halloway Feb 5, 2014
Showing with 10 additions and 0 deletions.
  1. +10 −0 test/clojure/test_clojure/reducers.clj
View
10 test/clojure/test_clojure/reducers.clj
@@ -61,3 +61,13 @@
(deftest test-nil
(is (= {:k :v} (reduce-kv assoc {:k :v} nil)))
(is (= 0 (r/fold + nil))))
+
+(deftest test-fold-runtime-exception
+ (is (thrown? IndexOutOfBoundsException
+ (let [test-map-count 1234
+ k-fail (rand-int test-map-count)]
+ (r/fold (fn ([])
+ ([ret [k v]])
+ ([ret k v] (when (= k k-fail)
+ (throw (IndexOutOfBoundsException.)))))
+ (zipmap (range test-map-count) (repeat :dummy)))))))

0 comments on commit 6c318f5

Please sign in to comment.