From 1be6a498ba8d1c113d4e0e7547d01c86c188e5c4 Mon Sep 17 00:00:00 2001 From: mrkn Date: Mon, 7 Jan 2013 14:42:52 +0000 Subject: * 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 --- test/bigdecimal/test_bigdecimal.rb | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'test') 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(/^#$/, 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 -- cgit v1.2.3