Skip to content

Commit

Permalink
added a test for generate-string with a nil object
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliver Flasch authored and lancepantz committed Sep 28, 2011
1 parent 5853c13 commit 312b5fa
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion test/clj_json/core_test.clj
Original file line number Diff line number Diff line change
Expand Up @@ -39,4 +39,11 @@
(fn [x] (reduce (fn [acc x] (assoc acc x true)) {} x))}]
(is (= {"foo" {"bang" true, "bar" true}}
(json/parse-string
(json/generate-string {"foo" #{"bar" "bang"}}))))))
(json/generate-string {"foo" #{"bar" "bang"}}))))))

(deftest test-redefine-coercions-with-nil
(binding [clj-json.core/*coercions* {clojure.lang.PersistentHashSet
(fn [x] (reduce (fn [acc x] (assoc acc x true)) {} x))}]
(is (= nil
(json/parse-string
(json/generate-string nil))))))

0 comments on commit 312b5fa

Please sign in to comment.