diff options
author | The Stuarts <pair@thinkrelevance.com> | 2010-03-19 15:06:12 -0400 |
---|---|---|
committer | The Stuarts <pair@thinkrelevance.com> | 2010-03-19 15:06:12 -0400 |
commit | 1e3333335334139669fb1e859fb0c3cb77b968df (patch) | |
tree | cb30a9f6899e61c5398e2dd4a4a50022f376f77e | |
parent | f7a454fba2e2f8fea30dedd9f58a13d73b54f2ec (diff) |
fix PushbackReader bug
-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"))) |