diff --git a/src/json.c b/src/json.c index 8749009a24b..ca9be26cd9f 100644 --- a/src/json.c +++ b/src/json.c @@ -1655,9 +1655,9 @@ json_parse_value (struct json_parser *parser, int c) return json_parse_number (parser, c); else { - int c2 = json_input_get (parser); - int c3 = json_input_get (parser); - int c4 = json_input_get (parser); + int c2 = json_input_get_if_possible (parser); + int c3 = json_input_get_if_possible (parser); + int c4 = json_input_get_if_possible (parser); int c5 = json_input_get_if_possible (parser); if (c == 't' && c2 == 'r' && c3 == 'u' && c4 == 'e' diff --git a/test/src/json-tests.el b/test/src/json-tests.el index a1bafadaa87..628a5a3de57 100644 --- a/test/src/json-tests.el +++ b/test/src/json-tests.el @@ -215,11 +215,9 @@ (should-error (json-serialize ["u\u00C4\xCCv"]) :type 'wrong-type-argument)) (ert-deftest json-parse-string/short () - :expected-result :failed (should-error (json-parse-string "") :type 'json-end-of-file) (should-error (json-parse-string " ") :type 'json-end-of-file) - ;; BUG: currently results in `json-end-of-file' for short non-empty inputs. - (dolist (s '("a" "ab" "abc" "abcd" + (dolist (s '("a" "ab" "abc" "abcd" "\0" "\1" "t" "tr" "tru" "truE" "truee" "n" "nu" "nul" "nulL" "nulll" "f" "fa" "fal" "fals" "falsE" "falsee"))