aboutsummaryrefslogtreecommitdiffstats
path: root/test/bigdecimal
diff options
context:
space:
mode:
authormrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-07 14:42:52 +0000
committermrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-01-07 14:42:52 +0000
commit1be6a498ba8d1c113d4e0e7547d01c86c188e5c4 (patch)
tree34d65cf35842ad8a4c851fee2e52a8f109625314 /test/bigdecimal
parent19768b6cacb1319f34944a0dc5e0bbe099d2d18e (diff)
downloadruby-1be6a498ba8d1c113d4e0e7547d01c86c188e5c4.tar.gz
* ext/bigdecimal/bigdecimal.c (rmpd_power_by_big_decimal):
add RB_GC_GUARD to prevent the immediate object is GCed too early. This patch was made by Yusuke Endoh. [Bug #7044] [ruby-core:47632] * test/bigdecimal/test_bigdecimal.rb: add a reproduction test for the issue [Bug #7044] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@38734 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/bigdecimal')
-rw-r--r--test/bigdecimal/test_bigdecimal.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb
index a06adb1356..51d2e8f309 100644
--- a/test/bigdecimal/test_bigdecimal.rb
+++ b/test/bigdecimal/test_bigdecimal.rb
@@ -874,6 +874,12 @@ class TestBigDecimal < Test::Unit::TestCase
assert_match(/^#<BigDecimal:[0-9a-f]+,'0.12345678E4',#{prec}\(#{maxprec}\)>$/, x.inspect)
end
+ def test_power
+ assert_nothing_raised(TypeError, '[ruby-core:47632]') do
+ 1000.times { BigDecimal.new('1001.10')**0.75 }
+ end
+ end
+
def test_power_with_nil
assert_raise(TypeError) do
BigDecimal(3) ** nil