summaryrefslogtreecommitdiff
path: root/test/src/json-tests.el
diff options
context:
space:
mode:
Diffstat (limited to 'test/src/json-tests.el')
-rw-r--r--test/src/json-tests.el8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/src/json-tests.el b/test/src/json-tests.el
index 9884e9a2d57..5d9f6b3840c 100644
--- a/test/src/json-tests.el
+++ b/test/src/json-tests.el
@@ -52,6 +52,14 @@
(should (equal (json-serialize table)
"{\"abc\":[1,2,true],\"def\":null}"))))
+(ert-deftest json-serialize/object-with-duplicate-keys ()
+ (skip-unless (fboundp 'json-serialize))
+ (let ((table (make-hash-table :test #'eq)))
+ (puthash (copy-sequence "abc") [1 2 t] table)
+ (puthash (copy-sequence "abc") :null table)
+ (should (equal (hash-table-count table) 2))
+ (should-error (json-serialize table) :type 'wrong-type-argument)))
+
(ert-deftest json-parse-string/object ()
(skip-unless (fboundp 'json-parse-string))
(let ((input