diff options
author | ktsj <ktsj@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-09 01:49:38 +0000 |
---|---|---|
committer | ktsj <ktsj@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-08-09 01:49:38 +0000 |
commit | 214cbdc9434b6ba967c00179473666732258c913 (patch) | |
tree | cf6a006486982f86c9c93b58a82462c6c19e5143 /test/ruby/test_lambda.rb | |
parent | 4a7afb71ec9ee3724dc14de4738cb5f20e0129d2 (diff) |
* vm_insnhelper.c (vm_invoke_block): returning from lambda proc
now always exits from the Proc. [ruby-core:56193] [Feature #8693]
* NEWS, test/ruby/test_lambda.rb: ditto. Patch by nobu.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_lambda.rb')
-rw-r--r-- | test/ruby/test_lambda.rb | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_lambda.rb b/test/ruby/test_lambda.rb index 40bd134e2f..f042ab015e 100644 --- a/test/ruby/test_lambda.rb +++ b/test/ruby/test_lambda.rb @@ -89,4 +89,24 @@ class TestLambdaParameters < Test::Unit::TestCase assert_send([e.backtrace.first, :start_with?, "#{__FILE__}:#{line}:"], bug6151) assert_equal(0, called) end + + def return_in_current(val) + 1.tap &->(*) {return 0} + val + end + + def yield_block + yield + end + + def return_in_callee(val) + yield_block &->(*) {return 0} + val + end + + def test_return + feature8693 = '[ruby-core:56193] [Feature #8693]' + assert_equal(42, return_in_current(42), feature8693) + assert_equal(42, return_in_callee(42), feature8693) + end end |