Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add a few tests for collections.

  • Loading branch information...
commit 51652d8ff1c3d06526ab618635ea02ebd4bf8eeb 1 parent 5aba93b
@technomancy technomancy authored
Showing with 16 additions and 0 deletions.
  1. +16 −0 test/test.clj
View
16 test/test.clj
@@ -92,6 +92,22 @@
(is (= (json/decode-from-str "-9.3e+0") -9.3)))
;;;;;;;;;;;;;;;;;;;;;;;;;;;
+;; Collections ;;
+;;;;;;;;;;;;;;;;;;;;;;;;;;;
+
+(deftest collections
+ (is (:json= ["1 2 3"]))
+ (is (:json= {:a 1 :b 2}))
+ (is (:json= {:a "a" :b "b"}))
+ ;; default set behaviour:
+ (is (= ["a" "b"]
+ (json/decode (json/encode #{"a" "b"}))))
+ ;; constant-time-lookup-preserving behaviour:
+ (is (= {:a :a :b :b})
+ (binding [org.danlarkin.json.encoder/*sets-as-maps* true]
+ (json/decode (json/encode #{"a" "b"})))))
+
+;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Unicode ;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;
(deftest unicode-chars
Please sign in to comment.
Something went wrong with that request. Please try again.