Commit 7f27d42f authored by Basil L. Contovounesios's avatar Basil L. Contovounesios Committed by Noam Postavsky

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
parent 10bd3b3a
......@@ -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.
......@@ -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 }"))
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment