From: Basil L. Contovounesios Date: Fri, 16 Feb 2018 17:11:49 +0000 (+0000) Subject: Pass json-readtable-error data as a list (bug#30489) X-Git-Tag: emacs-26.1-rc1~84 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=7f27d42f0b;p=emacs.git 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. --- 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." (push (list c 'json-read-number) table)) (pcase-dolist (`(,c . ,rest) table) (push `((eq ,char ,c) (,@rest)) res)) - `(cond ,@res (t (signal 'json-readtable-error ,char))))) + `(cond ,@res (t (signal 'json-readtable-error (list ,char)))))) (defun json-read () "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." (json-tests--with-temp-buffer "" (should-error (json-read) :type 'json-end-of-file)) (json-tests--with-temp-buffer "xxx" - (should-error (json-read) :type 'json-readtable-error))) + (let ((err (should-error (json-read) :type 'json-readtable-error))) + (should (equal (cdr err) '(?x)))))) (ert-deftest test-json-read-from-string () (let ((json-string "{ \"a\": 1 }"))