summaryrefslogtreecommitdiff
path: root/test/src/json-tests.el
diff options
context:
space:
mode:
authorJoão Távora <joaotavora@gmail.com>2018-05-30 02:48:31 +0100
committerJoão Távora <joaotavora@gmail.com>2018-05-30 02:53:19 +0100
commit506d38434b54a3999163a78c91fb06a524a5cad2 (patch)
treedfd7846f020cc41c5863b2af567856107b90cc9d /test/src/json-tests.el
parent224f8ea95f00cc60ee77aeaad6585bb2ef845f70 (diff)
downloademacs-scratch/support-plists-in-jsonc.tar.gz
Instead of a json-serialize-use-plists global, use function argsscratch/support-plists-in-jsonc
* src/json.c (syms_of_json): Don't defive json-serialize-use-plists (Fjson_insert, lisp_to_json, list_to_json_toplevel_1) (list_to_json_toplevel, Fjson_serialize): Use and pass around use_plists arg. * doc/lispref/text.texi: (Parsing JSON): json-serialize and json-insert now have a USE-PLISTS arg. * test/src/json-tests.el (json-serialize/object): Use json-serialize's USE-PLISTS arg.
Diffstat (limited to 'test/src/json-tests.el')
-rw-r--r--test/src/json-tests.el21
1 files changed, 10 insertions, 11 deletions
diff --git a/test/src/json-tests.el b/test/src/json-tests.el
index 5c9be20e957..b7c17a4cf10 100644
--- a/test/src/json-tests.el
+++ b/test/src/json-tests.el
@@ -71,17 +71,16 @@
(should-error (json-serialize '#1=((a . 1) . #1#)) :type 'circular-list)
(should-error (json-serialize '(#1=(a #1#))))
- (let ((json-serialize-use-plists t))
- (should (equal (json-serialize '(:abc [1 2 t] :def :null))
- "{\"abc\":[1,2,true],\"def\":null}"))
- (should (equal (json-serialize '(abc [1 2 t] :def :null))
- "{\"abc\":[1,2,true],\"def\":null}"))
- (should-error (json-serialize '#1=(:a 1 . #1#)) :type 'circular-list)
- (should-error (json-serialize '((abc . 1))) :type 'wrong-type-argument)
- (should-error (json-serialize '(:foo bar (abc . 1)))
- :type 'wrong-type-argument)
- (should-error (json-serialize '(:foo bar :odd-numbered))
- :type 'wrong-type-argument)))
+ (should (equal (json-serialize '(:abc [1 2 t] :def :null) t)
+ "{\"abc\":[1,2,true],\"def\":null}"))
+ (should (equal (json-serialize '(abc [1 2 t] :def :null) t)
+ "{\"abc\":[1,2,true],\"def\":null}"))
+ (should-error (json-serialize '#1=(:a 1 . #1#) t) :type 'circular-list)
+ (should-error (json-serialize '((abc . 1)) t) :type 'wrong-type-argument)
+ (should-error (json-serialize '(:foo bar (abc . 1)) t)
+ :type 'wrong-type-argument)
+ (should-error (json-serialize '(:foo bar :odd-numbered) t)
+ :type 'wrong-type-argument))
(ert-deftest json-serialize/object-with-duplicate-keys ()
(skip-unless (fboundp 'json-serialize))