Browse files

fix PushbackReader bug

  • Loading branch information...
1 parent f7a454f commit 1e3333335334139669fb1e859fb0c3cb77b968df The Stuarts committed Mar 19, 2010
Showing with 9 additions and 1 deletion.
  1. +1 −1 src/main/clojure/clojure/contrib/json.clj
  2. +8 −0 src/test/clojure/clojure/contrib/test_json.clj
View
2 src/main/clojure/clojure/contrib/json.clj
@@ -179,7 +179,7 @@
keywordize? eof-error? eof-value))
PushbackReader
(read-json-from [input keywordize? eof-error? eof-value]
- (read-json-reader (PushbackReader. (StringReader. input))
+ (read-json-reader input
keywordize? eof-error? eof-value))
Reader
(read-json-from [input keywordize? eof-error? eof-value]
View
8 src/test/clojure/clojure/contrib/test_json.clj
@@ -1,6 +1,14 @@
(ns clojure.contrib.test-json
(:use clojure.test clojure.contrib.json))
+(deftest can-read-from-pushback-reader
+ (let [s (java.io.PushbackReader. (java.io.StringReader. "42"))]
+ (is (= 42 (read-json s)))))
+
+(deftest can-read-from-reader
+ (let [s (java.io.StringReader. "42")]
+ (is (= 42 (read-json s)))))
+
(deftest can-read-numbers
(is (= 42 (read-json "42")))
(is (= -3 (read-json "-3")))

0 comments on commit 1e33333

Please sign in to comment.