aboutsummaryrefslogtreecommitdiffstats
path: root/test/src
diff options
context:
space:
mode:
authorMattias Engdegård2024-04-01 16:58:03 +0200
committerMattias Engdegård2024-04-01 17:07:04 +0200
commitdbfe3cae2d9497fb14c83f26425f9421d1ef57cb (patch)
tree405f252cd6b0853f0134475b605d423bd93eb16b /test/src
parentf53152faad170a93b7977c81f736cc787c2f9b71 (diff)
downloademacs-dbfe3cae2d9497fb14c83f26425f9421d1ef57cb.tar.gz
emacs-dbfe3cae2d9497fb14c83f26425f9421d1ef57cb.zip
Update JSON parser test and docs
* test/src/json-tests.el (json-parse-string/object): Duplicated object keys are now retained in alist and plist output. * etc/NEWS: Mention it.
Diffstat (limited to 'test/src')
-rw-r--r--test/src/json-tests.el7
1 files changed, 2 insertions, 5 deletions
diff --git a/test/src/json-tests.el b/test/src/json-tests.el
index 628a5a3de57..8b730ef8c90 100644
--- a/test/src/json-tests.el
+++ b/test/src/json-tests.el
@@ -156,9 +156,6 @@
156 ) 156 )
157 157
158(ert-deftest json-parse-string/object () 158(ert-deftest json-parse-string/object ()
159 :expected-result :failed
160 ;; FIXME: This currently fails. Should the parser deduplicate keys?
161 ;; Never, always, or for alist and plist only?
162 (let ((input 159 (let ((input
163 "{ \"abc\" : [1, 2, true], \"def\" : null, \"abc\" : [9, false] }\n")) 160 "{ \"abc\" : [1, 2, true], \"def\" : null, \"abc\" : [9, false] }\n"))
164 (let ((actual (json-parse-string input))) 161 (let ((actual (json-parse-string input)))
@@ -167,9 +164,9 @@
167 (should (equal (cl-sort (map-pairs actual) #'string< :key #'car) 164 (should (equal (cl-sort (map-pairs actual) #'string< :key #'car)
168 '(("abc" . [9 :false]) ("def" . :null))))) 165 '(("abc" . [9 :false]) ("def" . :null)))))
169 (should (equal (json-parse-string input :object-type 'alist) 166 (should (equal (json-parse-string input :object-type 'alist)
170 '((abc . [9 :false]) (def . :null)))) 167 '((abc . [1 2 t]) (def . :null) (abc . [9 :false]))))
171 (should (equal (json-parse-string input :object-type 'plist) 168 (should (equal (json-parse-string input :object-type 'plist)
172 '(:abc [9 :false] :def :null))))) 169 '(:abc [1 2 t] :def :null :abc [9 :false])))))
173 170
174(ert-deftest json-parse-string/object-unicode-keys () 171(ert-deftest json-parse-string/object-unicode-keys ()
175 (let ((input "{\"é\":1,\"☃\":2,\"𐌐\":3}")) 172 (let ((input "{\"é\":1,\"☃\":2,\"𐌐\":3}"))