 (ns clojure.data.json-test
   (:use clojure.test clojure.data.json))
 
-#_(deftest can-read-from-pushback-reader
+(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
+    (is (= 42 (parse s)))))
+
+(deftest can-read-from-reader
   (let [s (java.io.StringReader. "42")]
-    (is (= 42 (read-json s)))))
+    (is (= 42 (parse s)))))
 
 (deftest can-read-numbers
   (is (= 42 (parse-str "42")))

  (is (= 3.14159 (parse-str "3.14159")))
  (is (= 6.022e23 (parse-str "6.022e23"))))

(deftest can-read-null
  (is (= nil (parse-str "null"))))


(deftest can-get-string-keys
  (is (= {"a" [1 2 {"b" [3 "four"]} 5.5]}
         (parse-str "{\"a\":[1,2,{\"b\":[3,\"four\"]},5.5]}"))))

(deftest can-keywordize-keys
  (is (= {:a [1 2 {:b [3 "four"]} 5.5]}
         (parse-str "{\"a\":[1,2,{\"b\":[3,\"four\"]},5.5]}"
                    :key-fn keyword))))

(deftest can-convert-values
  (is (= {:number 42 :date (java.sql.Date. 55 6 12)}
         (parse-str "{\"number\": 42, \"date\": \"1955-07-12\"}"
                    :key-fn keyword
                    :value-fn (fn [k v]
                                (if (= :date k)
                                  (java.sql.Date/valueOf v)
                                  v))))))

(deftest can-omit-values
  (is (= {:number 42}
         (parse-str "{\"number\": 42, \"date\": \"1955-07-12\"}"
                    :key-fn keyword
                    :value-fn (fn thisfn [k v]
                                (if (= :date k)
                                  thisfn
                                  v))))))

(declare pass1-string)

