diff options
-rw-r--r-- | src/main/clojure/clojure/contrib/json.clj | 2 | ||||
-rw-r--r-- | src/test/clojure/clojure/contrib/test_json.clj | 8 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/main/clojure/clojure/contrib/json.clj b/src/main/clojure/clojure/contrib/json.clj index 595cde40..0a3e7b33 100644 --- a/src/main/clojure/clojure/contrib/json.clj +++ b/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] diff --git a/src/test/clojure/clojure/contrib/test_json.clj b/src/test/clojure/clojure/contrib/test_json.clj index f5b5b448..e62df3a8 100644 --- a/src/test/clojure/clojure/contrib/test_json.clj +++ b/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"))) |