summaryrefslogtreecommitdiff
path: root/test/json/json_parser_test.rb
AgeCommit message (Collapse)Author
2025-12-11[ruby/json] Revert "Skip test failing with JRuby in CI"Étienne Barrié
This reverts commit https://github.com/ruby/json/commit/b7e1734d9ca0. https://github.com/ruby/json/commit/5793694ee6
2025-12-11[ruby/json] Add `allow_control_characters` parsing optionJean Boussier
While it's not allowed by the spec, some parsers like Oj do accept it, and it can be blocking a transition. Having this feature can help people migrate. https://github.com/ruby/json/commit/3459499cb3
2025-12-10[ruby/json] Add a specific error for unescaped newlinesJean Boussier
It's the most likely control character so it's worth giving a better error message for it. https://github.com/ruby/json/commit/1da3fd9233
2025-12-04[ruby/json] Fix a regression in parsing of unicode surogate pairsJean Boussier
Fix: https://github.com/ruby/json/issues/912 In the case of surogate pairs we consume two backslashes, so `json_next_backslash` need to ensure it's not sending us back in the stream. https://github.com/ruby/json/commit/0fce370c41
2025-11-22[ruby/json] Fix the parser to not accept invalid escapesJean Boussier
Only `"\/bfnrtu` are valid after a backslash. https://github.com/ruby/json/commit/f7f8f552ed
2025-11-21[ruby/json] Skip test failing with JRuby in CIÉtienne Barrié
https://github.com/ruby/json/commit/305d3832db
2025-11-21[ruby/json] Ractor-shareable JSON::CoderÉtienne Barrié
https://github.com/ruby/json/commit/58d60d6b76
2025-11-03[ruby/json] parser.c: Skip checking for escape sequences in ↵Jean Boussier
`rstring_cache_fetch` The caller already know if the string contains escape sequences so this check is redundant. Also stop calling `rstring_cache_fetch` from `json_string_unescape` as we know it won't match anyways. ``` == Parsing twitter.json (567916 bytes) ruby 3.4.6 (2025-09-16 revision https://github.com/ruby/json/commit/dbd83256b1) +YJIT +PRISM [arm64-darwin24] Warming up -------------------------------------- after 122.000 i/100ms Calculating ------------------------------------- after 1.226k (± 0.3%) i/s (815.85 μs/i) - 6.222k in 5.076282s Comparison: before: 1206.2 i/s after: 1225.7 i/s - 1.02x faster ``` https://github.com/ruby/json/commit/b8cdf3282d Co-Authored-By: Scott Myron <samyron@gmail.com>
2025-11-01[ruby/json] Enable JSON_DEBUG for parser/extconf.rbJean Boussier
https://github.com/ruby/json/commit/82b030f294
2025-11-01[ruby/json] Add test coverage for T_BIGNUM parsingJean Boussier
https://github.com/ruby/json/commit/f0150e2944
2025-09-19[ruby/json] parser: Reject invalid surogate pairs more consistently.Jean Boussier
https://github.com/ruby/json/commit/5855f4f603
2025-09-11[ruby/json] Improve test coverageÉtienne Barrié
Test SubArrayWrapper#[] and SubOpenStruct#[] https://github.com/ruby/json/commit/bae760aa19 Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2025-09-11[ruby/json] Stop checking for String#@-Étienne Barrié
https://github.com/ruby/json/commit/a9e05d6ff3 Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2025-09-11[ruby/json] Fix deprecation warning backtraceÉtienne Barrié
The gem root was including the test/ directory, so lines from tests were skipped, and the deprecation warnings were shown as coming from the test framework. https://github.com/ruby/json/commit/2ec31a7363 Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2025-08-27[ruby/json] Test behavior of parsing a too big FloatÉtienne Barrié
https://github.com/ruby/json/commit/8510ea5c1a
2025-07-28[ruby/json] Fix duplicated key warning locationJean Boussier
Followup: https://github.com/ruby/json/pull/818 Now the warning should point at the `JSON.parse` caller, and not inside the json gem itself. https://github.com/ruby/json/commit/cd51557387
2025-07-28[ruby/json] Improve duplicate key warning and errors to include the key nameJean Boussier
Followup: https://github.com/ruby/json/pull/818 https://github.com/ruby/json/commit/e3de4cc59c
2025-06-30Optimize 'json_parse_string' using SIMD.Scott Myron
2025-06-24[ruby/json] Deprecate duplicate keys in objectJean Boussier
There are few legitimate use cases for duplicate keys, and can in some case be exploited. Rather to always silently accept them, we should emit a warning, and in the future require to explictly allow them. https://github.com/ruby/json/commit/06f00a42e8
2025-05-13[ruby/json] Further improve parsing errorsJean Boussier
Report EOF when applicable instead of an empty fragment. Also stop fragment extraction on first whitespace. https://github.com/ruby/json/commit/cc1daba860 Notes: Merged: https://github.com/ruby/ruby/pull/13310
2025-05-13[ruby/json] parser.c: include line and column in error messagesJean Boussier
https://github.com/ruby/json/commit/30e35b9ba5 Notes: Merged: https://github.com/ruby/ruby/pull/13310
2025-03-12[ruby/json] Raise a ParserError on all incomplete unicode escape sequence.Jean Boussier
This was the behavior until `2.10.0` unadvertently changed it. `"\u1"` would raise, but `"\u1zzz"` wouldn't. https://github.com/ruby/json/commit/7d0637b9e6
2025-02-27[ruby/json] Ensure parser error snippets are valid UTF-8Jean Boussier
Fix: https://github.com/ruby/json/issues/755 Error messages now include a snippet of the document that doesn't parse to help locate the issue, however the way it was done wasn't UTF-8 aware, and it could result in exception messages with truncated characters. It would be nice to go a bit farther and actually support codepoints, but it's a lot of complexity to do it in C, perhaps if we move that logic to Ruby given it's not a performance sensitive codepath. https://github.com/ruby/json/commit/e144793b72
2025-01-20[ruby/json] Reject invalid number: `-` `-.1` `-e0`tompng
https://github.com/ruby/json/commit/b9bfeecfa9 Notes: Merged: https://github.com/ruby/ruby/pull/12602
2025-01-20[ruby/json] Raise parse error on invalid commentstompng
https://github.com/ruby/json/commit/2f57f40467 Notes: Merged: https://github.com/ruby/ruby/pull/12602
2025-01-20[ruby/json] Fix parsing incomplete unicode escape "\uaaa"tompng
https://github.com/ruby/json/commit/86c0d4eb7e Notes: Merged: https://github.com/ruby/ruby/pull/12602
2025-01-20[ruby/json] Fix a regression in the parser with leading /Jean Boussier
Ref: https://github.com/ruby/ruby/pull/12598 This could lead to an infinite loop. https://github.com/ruby/json/commit/f8cfa2696a Notes: Merged: https://github.com/ruby/ruby/pull/12600
2025-01-20Finalize Kevin's handrolled parser.Jean Boussier
And get rid of the Ragel parser. This is 7% faster on activitypub, 15% after on twitter and 11% faster on citm_catalog. There might be some more optimization opportunities, I did a quick optimization pass to fix a regression in string parsing, but other than that I haven't dug much in performance. Notes: Merged: https://github.com/ruby/ruby/pull/12598
2024-11-05[ruby/json] Strip whitespacesJean Boussier
https://github.com/ruby/json/commit/e85107197b Notes: Merged: https://github.com/ruby/ruby/pull/12003
2024-11-05[ruby/json] ResyncJean Boussier
Notes: Merged: https://github.com/ruby/ruby/pull/12003
2024-11-05[ruby/json] Re-enable passing testBenoit Daloze
https://github.com/ruby/json/commit/82d21f01c5 Notes: Merged: https://github.com/ruby/ruby/pull/12003
2024-11-01[ruby/json] Skip test failing on JRubyBenoit Daloze
https://github.com/ruby/json/commit/0f0b16b3f5
2024-11-01[ruby/json] Add test for parsing broken stringsBenoit Daloze
https://github.com/ruby/json/commit/850bd077c4
2024-10-26[ruby/json] Cleaner .encode / .force_encodingJean Boussier
https://github.com/ruby/json/commit/cecf04fdfc
2024-10-26[ruby/json] Modernize heredocsJean Boussier
https://github.com/ruby/json/commit/fb25e94aea
2024-10-26[ruby/json] raise_parse_error: avoid UBJean Boussier
Fix: https://github.com/ruby/json/pull/625 Declaring the buffer in a sub block cause bugs on some compilers. https://github.com/ruby/json/commit/90967c9eb0
2024-10-26[ruby/json] Drop compatibility for missing Array#permutation (Ruby <= 1.8.6)Étienne Barrié
https://github.com/ruby/json/commit/b02091ed44 Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-10-26Use frozen string literalsÉtienne Barrié
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-10-26Use Encoding constants, String#bÉtienne Barrié
Co-authored-by: Jean Boussier <jean.boussier@gmail.com>
2024-10-26[ruby/json] Limit the size of ParserError exception messagesJean Boussier
Fix: https://github.com/ruby/json/issues/534 Only include up to 32 bytes of unparseable the source. https://github.com/ruby/json/commit/f44995cfb6
2024-10-18Relax Pure::Parser's comment regex...Stephen Humphries
...to allow any character sequence, including "/*", before then end sequence of a multi-line ANSI C-style comment .
2024-10-18[ruby/json] Assume Encoding is definedJean Boussier
https://github.com/ruby/json/commit/8713aa4812
2024-10-18[ruby/json] Always dup argument to preserve original encoding for force_encodingTakumasa Ochi
https://github.com/ruby/json/commit/db9a489ca2
2024-10-07Update references to flori/jsonJean Boussier
Now that the repository was transfered, these links will become dead in a few months. Notes: Merged: https://github.com/ruby/ruby/pull/11820
2024-01-31[flori/json] Make OpenStruct support as optionalHiroshi SHIBATA
https://github.com/flori/json/commit/202ffe2335
2023-10-11[flori/json] skip TruffleRubyHiroshi SHIBATA
https://github.com/flori/json/commit/bab704eb49
2023-08-25Use require_relative in JSON testsTakashi Kokubun
to prevent them from conflicting with yarp/test_helper
2023-07-18[flori/json] Skip BigDecimal tests when it's missing to loadHiroshi SHIBATA
https://github.com/flori/json/commit/3dd36c6077
2022-07-29[flori/json] test parsing of unicode, mixing literal characters with escapedEthan
https://github.com/flori/json/commit/82fe866da2 Notes: Merged: https://github.com/ruby/ruby/pull/6200
2022-05-20[flori/json] Fix parser bug for empty string allocationAndrew Bromwich
When `HAVE_RB_ENC_INTERNED_STR` is enabled it is possible to pass through a null pointer to `rb_enc_interned_str` resulting in a segfault Fixes #495 https://github.com/flori/json/commit/b59368a8c2