summaryrefslogtreecommitdiff
path: root/test/json
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-10 03:41:50 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-10 03:41:50 +0000
commit2eb5d1dea4d9a604405f6725ef967a450218408d (patch)
treeceb8cc4b647b23cb6e534766f2eb991432796fe4 /test/json
parente5c418d9910b3170ca13aee161ac6b08e9ae3a0c (diff)
Add timeout to TC_JSONGenerate#test_gc.
http://fb.rubyci.org/~chkbuild/ruby-trunk/log/20120409T230301Z.log.html.gz git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35276 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/json')
-rwxr-xr-xtest/json/test_json_generate.rb9
1 files changed, 6 insertions, 3 deletions
diff --git a/test/json/test_json_generate.rb b/test/json/test_json_generate.rb
index 3a1ddc6..ab09ba4 100755
--- a/test/json/test_json_generate.rb
+++ b/test/json/test_json_generate.rb
@@ -214,14 +214,17 @@ EOT
assert_equal 128, s.buffer_initial_length
end
+ require'timeout'
def test_gc
bignum_too_long_to_embed_as_string = 1234567890123456789012345
expect = bignum_too_long_to_embed_as_string.to_s
stress, GC.stress = GC.stress, true
- 10.times do |i|
- tmp = bignum_too_long_to_embed_as_string.to_json
- assert_equal expect, tmp
+ timeout(1) do
+ 10.times do |i|
+ tmp = bignum_too_long_to_embed_as_string.to_json
+ assert_equal expect, tmp
+ end
end
ensure
GC.stress = stress