diff options
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/json-tests.el | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/test/src/json-tests.el b/test/src/json-tests.el index 5d9f6b3840c..b23439a59fd 100644 --- a/test/src/json-tests.el +++ b/test/src/json-tests.el | |||
| @@ -50,7 +50,19 @@ | |||
| 50 | (puthash "abc" [1 2 t] table) | 50 | (puthash "abc" [1 2 t] table) |
| 51 | (puthash "def" :null table) | 51 | (puthash "def" :null table) |
| 52 | (should (equal (json-serialize table) | 52 | (should (equal (json-serialize table) |
| 53 | "{\"abc\":[1,2,true],\"def\":null}")))) | 53 | "{\"abc\":[1,2,true],\"def\":null}"))) |
| 54 | (should (equal (json-serialize '((abc . [1 2 t]) (def . :null))) | ||
| 55 | "{\"abc\":[1,2,true],\"def\":null}")) | ||
| 56 | (should (equal (json-serialize nil) "{}")) | ||
| 57 | (should (equal (json-serialize '((abc))) "{\"abc\":{}}")) | ||
| 58 | (should (equal (json-serialize '((a . 1) (b . 2) (a . 3))) | ||
| 59 | "{\"a\":1,\"b\":2}")) | ||
| 60 | (should-error (json-serialize '(abc)) :type 'wrong-type-argument) | ||
| 61 | (should-error (json-serialize '((a 1))) :type 'wrong-type-argument) | ||
| 62 | (should-error (json-serialize '((1 . 2))) :type 'wrong-type-argument) | ||
| 63 | (should-error (json-serialize '((a . 1) . b)) :type 'wrong-type-argument) | ||
| 64 | (should-error (json-serialize '#1=((a . 1) . #1#)) :type 'circular-list) | ||
| 65 | (should-error (json-serialize '(#1=(a #1#))))) | ||
| 54 | 66 | ||
| 55 | (ert-deftest json-serialize/object-with-duplicate-keys () | 67 | (ert-deftest json-serialize/object-with-duplicate-keys () |
| 56 | (skip-unless (fboundp 'json-serialize)) | 68 | (skip-unless (fboundp 'json-serialize)) |