summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorJean Boussier <[email protected]>2024-10-25 09:55:25 +0200
committerHiroshi SHIBATA <[email protected]>2024-10-26 18:44:15 +0900
commita5bd0c638a600a5cfb0d99ee64ba8172a9c66535 (patch)
treeff9d9c676a992d621ab027b1dfd171f58710d875 /test
parent3daf16e51fcd21e964525d7e64cec646a49236ff (diff)
[ruby/json] Workaround rubygems $LOAD_PATH bug
Ref: https://github.com/ruby/json/issues/647 Ref: https://github.com/rubygems/rubygems/pull/6490 Older rubygems are executing `extconf.rb` with a broken `$LOAD_PATH` causing the `json` gem native extension to be loaded with the stdlib version of the `.rb` files. This fails with ``` json/common.rb:82:in `initialize': wrong number of arguments (given 1, expected 0) (ArgumentError) ``` Since this is just for `extconf.rb` we can probably just accept that extra argument and ignore it. The bug was fixed in rubygems 3.4.9 / 2023-03-20 https://github.com/ruby/json/commit/1f5e849fe0
Diffstat (limited to 'test')
-rwxr-xr-xtest/json/json_generator_test.rb24
1 files changed, 12 insertions, 12 deletions
diff --git a/test/json/json_generator_test.rb b/test/json/json_generator_test.rb
index 01e412c960..1670445a7f 100755
--- a/test/json/json_generator_test.rb
+++ b/test/json/json_generator_test.rb
@@ -268,19 +268,19 @@ class JSONGeneratorTest < Test::Unit::TestCase
end
def test_gc
- if respond_to?(:assert_in_out_err) && !(RUBY_PLATFORM =~ /java/)
- assert_in_out_err(%w[-rjson -Ilib -Iext], <<-EOS, [], [])
- bignum_too_long_to_embed_as_string = 1234567890123456789012345
- expect = bignum_too_long_to_embed_as_string.to_s
- GC.stress = true
-
- 10.times do |i|
- tmp = bignum_too_long_to_embed_as_string.to_json
- raise "'\#{expect}' is expected, but '\#{tmp}'" unless tmp == expect
- end
- EOS
+ pid = fork do
+ bignum_too_long_to_embed_as_string = 1234567890123456789012345
+ expect = bignum_too_long_to_embed_as_string.to_s
+ GC.stress = true
+
+ 10.times do |i|
+ tmp = bignum_too_long_to_embed_as_string.to_json
+ raise "#{expect}' is expected, but '#{tmp}'" unless tmp == expect
+ end
end
- end if GC.respond_to?(:stress=)
+ _, status = Process.waitpid2(pid)
+ assert_predicate status, :success?
+ end if GC.respond_to?(:stress=) && Process.respond_to?(:fork)
def test_configure_using_configure_and_merge
numbered_state = {