1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Run TC_JSONGenerate#test_gc in a separate process.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35397 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
naruse 2012-04-19 03:21:23 +00:00
parent c1903a9f17
commit ec0bd633e2

View file

@ -215,26 +215,17 @@ EOT
end
def test_gc
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
require_relative '../ruby/envutil.rb'
assert_in_out_err(%w[-rjson --disable-gems], <<-EOS, [], [])
bignum_too_long_to_embed_as_string = 1234567890123456789012345
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
expect = bignum_too_long_to_embed_as_string.to_s
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
GC.start
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
stress, GC.stress = GC.stress, true
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
GC.stress = true
10.times do |i|
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
tmp = bignum_too_long_to_embed_as_string.to_json
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
assert_equal expect, tmp
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
raise "'\#{expect}' is expected, but '\#{tmp}'" unless tmp == expect
end
$stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
ensure
GC.stress = stress
EOS
end if GC.respond_to?(:stress=)
if defined?(JSON::Ext::Generator)