diff options
author | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-29 08:55:11 +0000 |
---|---|---|
committer | mrkn <mrkn@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-09-29 08:55:11 +0000 |
commit | ecfc868bdb5e43cdb585767006e9df2de575eed2 (patch) | |
tree | 6820ba01ab6fddfd112811186129200ab9fc54c8 | |
parent | e6ad15393d7733d197394207235716b7cefd36fb (diff) | |
download | ruby-ecfc868bdb5e43cdb585767006e9df2de575eed2.tar.gz |
* ext/bigdecimal/bigdecimal.c (BigDecimal_save_limit):
return the result of a block.
* test/bigdecimal/test_bigdecimal.rb (test_save_limit):
add a test for the above change.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29363 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 8 | ||||
-rw-r--r-- | ext/bigdecimal/bigdecimal.c | 2 | ||||
-rw-r--r-- | test/bigdecimal/test_bigdecimal.rb | 2 |
3 files changed, 11 insertions, 1 deletions
@@ -1,3 +1,11 @@ +Wed Sep 29 17:41:34 2010 Kenta Murata <mrkn@mrkn.jp> + + * ext/bigdecimal/bigdecimal.c (BigDecimal_save_limit): + return the result of a block. + + * test/bigdecimal/test_bigdecimal.rb (test_save_limit): + add a test for the above change. + Wed Sep 29 16:18:03 2010 NAKAMURA Usaku <usa@ruby-lang.org> * vm_dump.c (dump_thread): remove ununsed optional arguments. diff --git a/ext/bigdecimal/bigdecimal.c b/ext/bigdecimal/bigdecimal.c index f5885ebbbd..9ed8a562a3 100644 --- a/ext/bigdecimal/bigdecimal.c +++ b/ext/bigdecimal/bigdecimal.c @@ -1878,7 +1878,7 @@ BigDecimal_save_limit(VALUE self) VALUE ret = rb_protect(rb_yield, Qnil, &state); VpSetPrecLimit(limit); if (state) rb_jump_tag(state); - return Qnil; + return ret; } /* Document-class: BigDecimal diff --git a/test/bigdecimal/test_bigdecimal.rb b/test/bigdecimal/test_bigdecimal.rb index e8fed1661b..810630549b 100644 --- a/test/bigdecimal/test_bigdecimal.rb +++ b/test/bigdecimal/test_bigdecimal.rb @@ -137,6 +137,8 @@ class TestBigDecimal < Test::Unit::TestCase ensure BigDecimal.limit(old) end + + assert_equal(42, BigDecimal.save_limit { 42 }) end def test_exception_nan |