diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-18 01:08:34 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-18 01:08:34 +0000 |
commit | 9e56e14f50d6b9de3654538af7a44f1f6ac8894f (patch) | |
tree | d83b3dbc2d5071dbecb07f52252462738145bb4f /test/bigdecimal/test_bigdecimal.rb | |
parent | 5383ccd9814c2ec81413ed51f5ff8775497ebe5a (diff) | |
download | ruby-9e56e14f50d6b9de3654538af7a44f1f6ac8894f.tar.gz |
Run separate process if the test uses GC.stress.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35376 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/bigdecimal/test_bigdecimal.rb')
-rw-r--r-- | test/bigdecimal/test_bigdecimal.rb | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index deb2fa9a57..975983c029 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -1093,28 +1093,29 @@ class TestBigDecimal < Test::Unit::TestCase def test_split_under_gc_stress bug3258 = '[ruby-dev:41213]' - stress, GC.stress = GC.stress, true + expect = 10.upto(20).map{|i|[1, "1", 10, i+1].inspect} + assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, expect, [], bug3258) + GC.stress = true 10.upto(20) do |i| - b = BigDecimal.new("1"+"0"*i) - assert_equal([1, "1", 10, i+1], b.split, bug3258) + p BigDecimal.new("1"+"0"*i).split end - ensure - GC.stress = stress + EOS end def test_coerce_under_gc_stress - expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal" - under_gc_stress do + assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, [], []) + expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal" b = BigDecimal.new("1") + GC.stress = true 10.times do begin b.coerce(:too_long_to_embed_as_string) rescue => e - assert_instance_of TypeError, e - assert_equal expect, e.message + raise unless e.is_a?(TypeError) + raise "'\#{expect}' is expected, but '\#{e.message}'" unless e.message == expect end end - end + EOS end def test_INFINITY @@ -1178,17 +1179,17 @@ class TestBigDecimal < Test::Unit::TestCase end def test_BigMath_exp_under_gc_stress - expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal" - under_gc_stress do + assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, [], []) + expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal" 10.times do begin BigMath.exp(:too_long_to_embed_as_string, 6) rescue => e - assert_instance_of ArgumentError, e - assert_equal expect, e.message + raise unless e.is_a?(ArgumentError) + raise "'\#{expect}' is expected, but '\#{e.message}'" unless e.message == expect end end - end + EOS end def test_BigMath_log_with_nil @@ -1277,17 +1278,17 @@ class TestBigDecimal < Test::Unit::TestCase end def test_BigMath_log_under_gc_stress - expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal" - under_gc_stress do + assert_in_out_err(%w[-rbigdecimal --disable-gems], <<-EOS, [], []) + expect = ":too_long_to_embed_as_string can't be coerced into BigDecimal" 10.times do begin BigMath.log(:too_long_to_embed_as_string, 6) rescue => e - assert_instance_of ArgumentError, e - assert_equal expect, e.message + raise unless e.is_a?(ArgumentError) + raise "'\#{expect}' is expected, but '\#{e.message}'" unless e.message == expect end end - end + EOS end def test_dup |