diff options
| author | Andrea Corallo | 2021-02-17 22:26:28 +0100 |
|---|---|---|
| committer | Andrea Corallo | 2021-02-17 22:26:28 +0100 |
| commit | f92bb788a073c6b3ca7f188e0edea714598193fd (patch) | |
| tree | 9bea27955098bfc33d0daaa345cfa3dca5b695fd /test/src | |
| parent | 1fe5994bcb8b58012dbba0a5f7d03138c293286f (diff) | |
| parent | 6735bb3d22dc64f3fe42e4a7f439ea9d62f75b5a (diff) | |
| download | emacs-f92bb788a073c6b3ca7f188e0edea714598193fd.tar.gz emacs-f92bb788a073c6b3ca7f188e0edea714598193fd.zip | |
Merge remote-tracking branch 'savannah/master' into native-comp
Diffstat (limited to 'test/src')
| -rw-r--r-- | test/src/json-tests.el | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/src/json-tests.el b/test/src/json-tests.el index 4be11b8c81a..908945fcb08 100644 --- a/test/src/json-tests.el +++ b/test/src/json-tests.el | |||
| @@ -51,6 +51,34 @@ | |||
| 51 | (should (equal (json-parse-buffer) lisp)) | 51 | (should (equal (json-parse-buffer) lisp)) |
| 52 | (should (eobp))))) | 52 | (should (eobp))))) |
| 53 | 53 | ||
| 54 | (ert-deftest json-serialize/roundtrip-scalars () | ||
| 55 | "Check that Bug#42994 is fixed." | ||
| 56 | (skip-unless (fboundp 'json-serialize)) | ||
| 57 | (dolist (case '((:null "null") | ||
| 58 | (:false "false") | ||
| 59 | (t "true") | ||
| 60 | (0 "0") | ||
| 61 | (123 "123") | ||
| 62 | (-456 "-456") | ||
| 63 | (3.75 "3.75") | ||
| 64 | ;; The noncharacter U+FFFF should be passed through, | ||
| 65 | ;; cf. https://www.unicode.org/faq/private_use.html#noncharacters. | ||
| 66 | ("abc\uFFFFαβγ𝔸𝐁𝖢\"\\" | ||
| 67 | "\"abc\uFFFFαβγ𝔸𝐁𝖢\\\"\\\\\""))) | ||
| 68 | (cl-destructuring-bind (lisp json) case | ||
| 69 | (ert-info ((format "%S ↔ %S" lisp json)) | ||
| 70 | (should (equal (json-serialize lisp) json)) | ||
| 71 | (with-temp-buffer | ||
| 72 | (json-insert lisp) | ||
| 73 | (should (equal (buffer-string) json)) | ||
| 74 | (should (eobp))) | ||
| 75 | (should (equal (json-parse-string json) lisp)) | ||
| 76 | (with-temp-buffer | ||
| 77 | (insert json) | ||
| 78 | (goto-char 1) | ||
| 79 | (should (equal (json-parse-buffer) lisp)) | ||
| 80 | (should (eobp))))))) | ||
| 81 | |||
| 54 | (ert-deftest json-serialize/object () | 82 | (ert-deftest json-serialize/object () |
| 55 | (skip-unless (fboundp 'json-serialize)) | 83 | (skip-unless (fboundp 'json-serialize)) |
| 56 | (let ((table (make-hash-table :test #'equal))) | 84 | (let ((table (make-hash-table :test #'equal))) |