Commit 32f80eb6 authored by Philipp Stephani's avatar Philipp Stephani

Fix definition of whitespace in JSON

See
https://lists.gnu.org/archive/html/emacs-devel/2017-05/msg00115.html.

* lisp/json.el (json-skip-whitespace): Fix definition.
* test/lisp/json-tests.el (test-json-skip-whitespace): Adapt unit
test.
parent 140aefc3
......@@ -206,7 +206,11 @@ Unlike `reverse', this keeps the property-value pairs intact."
(defun json-skip-whitespace ()
"Skip past the whitespace at point."
(skip-chars-forward "\t\r\n\f\b "))
;; See
;; https://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf
;; or https://tools.ietf.org/html/rfc7159#section-2 for the
;; definition of whitespace in JSON.
(skip-chars-forward "\t\r\n "))
......
......@@ -89,7 +89,10 @@ Point is moved to beginning of the buffer."
(ert-deftest test-json-skip-whitespace ()
(json-tests--with-temp-buffer "\t\r\n\f\b { \"a\": 1 }"
(json-skip-whitespace)
(should (equal (char-after (point)) ?{))))
(should (equal (char-after) ?\f)))
(json-tests--with-temp-buffer "\t\r\n\t { \"a\": 1 }"
(json-skip-whitespace)
(should (equal (char-after) ?{))))
;;; Paths
......
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