diff options
Diffstat (limited to 'test/src/json-tests.el')
| -rw-r--r-- | test/src/json-tests.el | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/test/src/json-tests.el b/test/src/json-tests.el index 7a193545b1a..918b2336d0f 100644 --- a/test/src/json-tests.el +++ b/test/src/json-tests.el | |||
| @@ -209,6 +209,35 @@ Test with both unibyte and multibyte strings." | |||
| 209 | (should-not (bobp)) | 209 | (should-not (bobp)) |
| 210 | (should (looking-at-p (rx " [456]" eos))))) | 210 | (should (looking-at-p (rx " [456]" eos))))) |
| 211 | 211 | ||
| 212 | (ert-deftest json-parse-with-custom-null-and-false-objects () | ||
| 213 | (let ((input | ||
| 214 | "{ \"abc\" : [1, 2, true], \"def\" : null, \"abc\" : [9, false] }\n")) | ||
| 215 | (should (equal (json-parse-string input | ||
| 216 | :object-type 'plist | ||
| 217 | :null-object :json-null | ||
| 218 | :false-object :json-false) | ||
| 219 | '(:abc [9 :json-false] :def :json-null))) | ||
| 220 | (should (equal (json-parse-string input | ||
| 221 | :object-type 'plist | ||
| 222 | :false-object :json-false) | ||
| 223 | '(:abc [9 :json-false] :def :null))) | ||
| 224 | (should (equal (json-parse-string input | ||
| 225 | :object-type 'alist | ||
| 226 | :null-object :zilch) | ||
| 227 | '((abc . [9 :false]) (def . :zilch)))) | ||
| 228 | (should (equal (json-parse-string input | ||
| 229 | :object-type 'alist | ||
| 230 | :false-object nil | ||
| 231 | :null-object nil) | ||
| 232 | '((abc . [9 nil]) (def)))) | ||
| 233 | (let* ((thingy '(1 2 3)) | ||
| 234 | (retval (json-parse-string input | ||
| 235 | :object-type 'alist | ||
| 236 | :false-object thingy | ||
| 237 | :null-object nil))) | ||
| 238 | (should (equal retval `((abc . [9 ,thingy]) (def)))) | ||
| 239 | (should (eq (elt (cdr (car retval)) 1) thingy))))) | ||
| 240 | |||
| 212 | (ert-deftest json-insert/signal () | 241 | (ert-deftest json-insert/signal () |
| 213 | (skip-unless (fboundp 'json-insert)) | 242 | (skip-unless (fboundp 'json-insert)) |
| 214 | (with-temp-buffer | 243 | (with-temp-buffer |