summaryrefslogtreecommitdiff
path: root/test/json
AgeCommit message (Collapse)Author
2024-01-31[flori/json] Make OpenStruct support as optionalHiroshi SHIBATA
https://github.com/flori/json/commit/202ffe2335
2023-12-05[flori/json] cosmeticsHiroshi SHIBATA
https://github.com/flori/json/commit/39d6c854a4
2023-12-05[flori/json] The modern Ruby uses utf-8 encodings by defaultHiroshi SHIBATA
https://github.com/flori/json/commit/11b31210ac
2023-12-05[flori/json] Fix JSON.dump overload combinationtompng
https://github.com/flori/json/commit/41c2712a3b
2023-12-05[flori/json] Overload kwargs in JSON.dumpTakashi Kokubun
https://github.com/flori/json/commit/936f280f9f
2023-12-05[flori/json] JSON.dump: handle unenclosed hashes regressionJean Boussier
Fix: https://github.com/flori/json/issues/553 We can never add keyword arguments to `dump` otherwise existing code using unenclosed hash will break. https://github.com/flori/json/commit/8e0076a3f2
2023-12-01lib/helper only needs on flori/json repoHiroshi SHIBATA
2023-12-01Manually merged from flori/jsonHiroshi SHIBATA
> https://github.com/flori/json/pull/525 > Rename escape_slash in script_safe and also escape E+2028 and E+2029 Co-authored-by: Jean Boussier <jean.boussier@gmail.com> > https://github.com/flori/json/pull/454 > Remove unnecessary initialization of create_id in JSON.parse() Co-authored-by: Watson <watson1978@gmail.com>
2023-12-01Rename escape_slash in script_safe and also escape E+2028 and E+2029Jean Boussier
It is rather common to directly interpolate JSON string inside <script> tags in HTML as to provide configuration or parameters to a script. However this may lead to XSS vulnerabilities, to prevent that 3 characters need to be escaped: - `/` (forward slash) - `U+2028` (LINE SEPARATOR) - `U+2029` (PARAGRAPH SEPARATOR) The forward slash need to be escaped to prevent closing the script tag early, and the other two are valid JSON but invalid Javascript and can be used to break JS parsing. Given that the intent of escaping forward slash is the same than escaping U+2028 and U+2029, I chos to rename and repurpose the existing `escape_slash` option.
2023-12-01[flori/json] Fix "unexpected token" offset for InfinityJohn Hawthorn
Previously in the JSON::Ext parser, when we encountered an "Infinity" token (and weren't allowing NaN/Infinity) we would try to display the "unexpected token" at the character before. https://github.com/flori/json/commit/42ac170712
2023-12-01[flori/json] tests/ractor_test.rb: make assert_separately availableLucas Kanashiro
Require tests/lib/helper.rb to avoid: NoMethodError: undefined method `assert_separately' https://github.com/flori/json/commit/a81bcc0328
2023-10-11[flori/json] skip TruffleRubyHiroshi SHIBATA
https://github.com/flori/json/commit/bab704eb49
2023-10-11[flori/json] define_method is also private at Ruby 2.3 and 2.4Hiroshi SHIBATA
https://github.com/flori/json/commit/3804f38bf4
2023-10-11[flori/json] remove_method of Module is private at Ruby 2.3 and 2.4Hiroshi SHIBATA
https://github.com/flori/json/commit/6cbadf6b6e
2023-09-13Fixup 1851824b1c7b816e41b567b5310bb18ab6f9ff7aHiroshi SHIBATA
2023-09-13[flori/json] alias_method is private on Ruby 2.3 and 2.4Hiroshi SHIBATA
https://github.com/flori/json/commit/573ef94bc5
2023-09-05Prevent a warning: method redefined; discarding old includedYusuke Endoh
``` [ 3463/25719] JSONGeneratorTest#test_string_ext_included_calls_super/home/chkbuild/chkbuild/tmp/build/20230905T063003Z/ruby/test/json/json_generator_test.rb:411: warning: method redefined; discarding old included /home/chkbuild/chkbuild/tmp/build/20230905T063003Z/ruby/test/json/json_generator_test.rb:399: warning: previous definition of included was here ``` http://rubyci.s3.amazonaws.com/debian10/ruby-master/log/20230905T063003Z.log.html.gz
2023-09-05[flori/json] Removed code for Ruby 1.8Hiroshi SHIBATA
https://github.com/flori/json/commit/7f9c29038d
2023-08-28Remove --disable-gems in assert_in_out_errPeter Zhu
assert_in_out_err adds --disable=gems so we don't need to add --disable-gems in the args list. Notes: Merged: https://github.com/ruby/ruby/pull/8303
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
2023-07-18[flori/json] Skip unsupported test on JRubyNobuyoshi Nakada
https://github.com/flori/json/commit/7138bf32c7
2023-05-24[flori/json] Call `super` in `included` hookUfuk Kayserilioglu
The C extension defines an `included` hook for the `JSON::Ext::Generator::GeneratorMethods::String` module but neglects to call `super` in the hook. This can break the functionality of various other code that rely on the fact that `included` on `Module` will always be called. https://github.com/flori/json/commit/cd8bbe56a3
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
2022-05-20[flori/json] Remove unknown keyword arg from DateTime.parseCharles Oliver Nutter
This snuck in while addding tests for the `create_additions` feature. Caught by JRuby when we added the `limit` option to the Date/DateTime parsing methods, which causes this to be rejected as an unknown keyword. https://github.com/flori/json/commit/b1007dff66
2020-12-22Prepare to release json-2.5.0Hiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/3975
2020-12-21[json] Make json Ractor safeKenta Murata
2020-12-21[json] Stop using prototype objectsKenta Murata
2020-12-04SortedSet was removed at a3db08d7b6ff119223f77e3df00b4f6deac971e2Hiroshi SHIBATA
2020-10-21test/json/json_parser_test.rb: suppress warningsYusuke Endoh
http://rubyci.s3.amazonaws.com/ubuntu/ruby-master/log/20201021T123003Z.log.html.gz ``` /home/chkbuild/chkbuild/tmp/build/20201021T123003Z/ruby/test/json/json_parser_test.rb:227: warning: ambiguous first argument; put parentheses or a space even after `-' operator /home/chkbuild/chkbuild/tmp/build/20201021T123003Z/ruby/test/json/json_parser_test.rb:228: warning: ambiguous first argument; put parentheses or a space even after `-' operator ```
2020-10-20strip trailing spaces [ci skip]Nobuyoshi Nakada
2020-10-20Fix an issue with generate_pretty and empty objects in the Ruby and Java ↵Chris Seaton
implementations
2020-10-20Implement a freeze: parser optionJean Boussier
If set to true all parsed objects will be immediately frozen, and strings will be deduplicated if the Ruby implementation allows it.
2020-09-30Remove unneeded `begin` and `end`Kazuhiro NISHIYAMA
2020-09-30Fix `Leaked tempfile`sKazuhiro NISHIYAMA
http://rubyci.s3.amazonaws.com/debian10/ruby-master/log/20200930T033004Z.diff.html.gz ``` [n/n] JSONCommonInterfaceTest#test_load = <elapsed> s [n/n] JSONCommonInterfaceTest#test_load_file = <elapsed> s +Leaked tempfile: JSONCommonInterfaceTest#test_load_file: #<Tempfile:<build-dir>/tmp/20200930-7601-ptnv6i (closed)> [n/n] JSONCommonInterfaceTest#test_load_file! = <elapsed> s +Leaked tempfile: JSONCommonInterfaceTest#test_load_file!: #<Tempfile:<build-dir>/tmp/20200930-7601-1la6m9 (closed)> [n/n] JSONCommonInterfaceTest#test_load_file_with_option = <elapsed> s +Leaked tempfile: JSONCommonInterfaceTest#test_load_file_with_option: #<Tempfile:<build-dir>/tmp/20200930-7601-blf9hz (closed)> [n/n] JSONCommonInterfaceTest#test_load_file_with_option! = <elapsed> s +Leaked tempfile: JSONCommonInterfaceTest#test_load_file_with_option!: #<Tempfile:<build-dir>/tmp/20200930-7601-b5gsdb (closed)> ```
2020-09-28Remove unnecessary executable bit [ci skip]Kazuhiro NISHIYAMA
2020-09-25t/json/json_common_interface_test.rb: fix wrong indentationYusuke Endoh
to prevent: ``` test/json/json_common_interface_test.rb:182: warning: mismatched indentations at 'end' with 'def' at 169 ```
2020-09-25Extract assert assertion to assert_include and assert_not_include.Hiroshi SHIBATA
2020-09-25assert_true is not provided by test-unitHiroshi SHIBATA
Notes: Merged: https://github.com/ruby/ruby/pull/3581
2020-09-25Fix pure parser with unclosed arrays / objects [Fix #314]Marc-Andre Lafortune
Notes: Merged: https://github.com/ruby/ruby/pull/3581
2020-09-25[test] properly 'skip' test on JRubyKarol Bucek
an early return still caused ensure to execute, setting JSON constant to `nil` for later tests! Notes: Merged: https://github.com/ruby/ruby/pull/3581
2020-09-25[flori/json] Add `load_file` and `load_file!` methods, with tests. Fixes ↵Keith Bennett
issue #386. https://github.com/flori/json/commit/0be363c99b Notes: Merged: https://github.com/ruby/ruby/pull/3581
2020-09-25Add an option to escape forward slash characterJean Boussier
Squashed commit of the following: commit 26d181059989279a79c433cedcd893b4f52e42ee Author: Francois Chagnon <francois.chagnon@jadedpixel.com> Date: Tue Sep 15 21:17:34 2015 +0000 add config options for escape_slash commit fa282334051b16df91ca097dd7304b46f3bc7719 Author: Francois Chagnon <francois.chagnon@jadedpixel.com> Date: Mon Feb 9 21:09:33 2015 +0000 add forward slash to escape character Notes: Merged: https://github.com/ruby/ruby/pull/3581
2020-07-03test/json/json_fixtures_test.rb: Prevent an "out of range" warningYusuke Endoh
``` /home/mame/work/ruby/.ext/common/json/common.rb:263: warning: Float 23456789012E666 out of range ```
2020-07-03Reintroduce c565dfb09ad7d55fa671f65cea7088a914bf1931Yusuke Endoh
2020-07-01Merge json-2.3.1 from flori/jsonHiroshi SHIBATA
2020-07-01[flori/json] Fix test that wasn't testing anythingMarc-Andre Lafortune
https://github.com/flori/json/commit/d5c6566b41
2020-03-24test/json/test_helper.rb: Do not add a relative path to $LOAD_PATHYusuke Endoh
... because it conflicts with test/ruby/test_m17n.rb. An exception `incompatible character encodings: UTF-8 and UTF-16BE` occurs when: * a non-existence relative path is added to $LOAD_PATH, * ASCII-incompatible encoding is set to default_external, and * some file is loaded. ``` $LOAD_PATH << "no_existing_dir" Encoding.default_external = Encoding::UTF_16BE load "dummy.rb" #=> incompatible character encodings: UTF-8 and UTF-16BE ``` This issue can be actually observed by a combination of out-of-place build and the following command: make test-all TESTS="json ruby/m17n -n test_object_inspect_external" http://ci.rvm.jp/logfiles/brlog.trunk-test-random.20200322-221411 ASCII-incompatible default external encoding assumes that the cwd is the encoding, and it is attempted to beconcatenated with a non-existence relative LOAD_PATH UTF-8 string, which causes the exception. This changeset avoids a relative path.
2019-12-12Import json-2.3.0 from flori/jsonHiroshi SHIBATA