summaryrefslogtreecommitdiff
path: root/test/json/test_json_generate.rb
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-19 03:21:23 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-19 03:21:23 +0000
commitec0bd633e274544391d5f7899d0bfd5b7c63f872 (patch)
tree41eaba74cc15dcbdf6d9d5789fd570ee4d7cb99e /test/json/test_json_generate.rb
parentc1903a9f17ebda5c7c6d94e634d90e7ee0f98a72 (diff)
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
Diffstat (limited to 'test/json/test_json_generate.rb')
-rwxr-xr-xtest/json/test_json_generate.rb31
1 files changed, 11 insertions, 20 deletions
diff --git a/test/json/test_json_generate.rb b/test/json/test_json_generate.rb
index ed38e5d..8d06cec 100755
--- a/test/json/test_json_generate.rb
+++ b/test/json/test_json_generate.rb
@@ -215,26 +215,17 @@ EOT
end
def test_gc
- $stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
- 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__]
-
- 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__]
- end
- $stdout.puts 'debug: %s:%d:' % [__FILE__, __LINE__]
- ensure
- GC.stress = stress
+ require_relative '../ruby/envutil.rb'
+ assert_in_out_err(%w[-rjson --disable-gems], <<-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
end if GC.respond_to?(:stress=)
if defined?(JSON::Ext::Generator)