diff options
| author | Basil L. Contovounesios | 2018-02-16 17:11:49 +0000 |
|---|---|---|
| committer | Noam Postavsky | 2018-03-18 23:13:29 -0400 |
| commit | 7f27d42f0b64c74625e45909a0bf389d68eddc62 (patch) | |
| tree | 64d215ec60bc56ab11b88db14c24308c4d84dee4 | |
| parent | 10bd3b3af8acfc226acadc654298865cffc19cc9 (diff) | |
| download | emacs-7f27d42f0b64c74625e45909a0bf389d68eddc62.tar.gz emacs-7f27d42f0b64c74625e45909a0bf389d68eddc62.zip | |
Pass json-readtable-error data as a list (bug#30489)
* lisp/json.el (json-readtable-dispatch): Fix error data.
* test/lisp/json-tests.el (test-json-read): Check error data is a
list.
| -rw-r--r-- | lisp/json.el | 2 | ||||
| -rw-r--r-- | test/lisp/json-tests.el | 3 |
2 files changed, 3 insertions, 2 deletions
diff --git a/lisp/json.el b/lisp/json.el index b03a482ca6e..d374f452e6b 100644 --- a/lisp/json.el +++ b/lisp/json.el | |||
| @@ -685,7 +685,7 @@ become JSON objects." | |||
| 685 | (push (list c 'json-read-number) table)) | 685 | (push (list c 'json-read-number) table)) |
| 686 | (pcase-dolist (`(,c . ,rest) table) | 686 | (pcase-dolist (`(,c . ,rest) table) |
| 687 | (push `((eq ,char ,c) (,@rest)) res)) | 687 | (push `((eq ,char ,c) (,@rest)) res)) |
| 688 | `(cond ,@res (t (signal 'json-readtable-error ,char))))) | 688 | `(cond ,@res (t (signal 'json-readtable-error (list ,char)))))) |
| 689 | 689 | ||
| 690 | (defun json-read () | 690 | (defun json-read () |
| 691 | "Parse and return the JSON object following point. | 691 | "Parse and return the JSON object following point. |
diff --git a/test/lisp/json-tests.el b/test/lisp/json-tests.el index 47f8047b349..ea562e8b134 100644 --- a/test/lisp/json-tests.el +++ b/test/lisp/json-tests.el | |||
| @@ -309,7 +309,8 @@ Point is moved to beginning of the buffer." | |||
| 309 | (json-tests--with-temp-buffer "" | 309 | (json-tests--with-temp-buffer "" |
| 310 | (should-error (json-read) :type 'json-end-of-file)) | 310 | (should-error (json-read) :type 'json-end-of-file)) |
| 311 | (json-tests--with-temp-buffer "xxx" | 311 | (json-tests--with-temp-buffer "xxx" |
| 312 | (should-error (json-read) :type 'json-readtable-error))) | 312 | (let ((err (should-error (json-read) :type 'json-readtable-error))) |
| 313 | (should (equal (cdr err) '(?x)))))) | ||
| 313 | 314 | ||
| 314 | (ert-deftest test-json-read-from-string () | 315 | (ert-deftest test-json-read-from-string () |
| 315 | (let ((json-string "{ \"a\": 1 }")) | 316 | (let ((json-string "{ \"a\": 1 }")) |