diff options
author | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-10 08:31:48 +0000 |
---|---|---|
committer | ko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-10 08:31:48 +0000 |
commit | 4599d3efd7bfda591fd29e5647af2d5aa8be486c (patch) | |
tree | 3d7fddc4a9a1c7176914ed490cae60dce8c7bc43 /test/ruby/test_settracefunc.rb | |
parent | d63f9e933cf3ef44d7c6733bb6353ccde4324007 (diff) | |
download | ruby-4599d3efd7bfda591fd29e5647af2d5aa8be486c.tar.gz |
* vm.c (vm_exec): support :b_return event for "lambda{return}.call".
[Bug #8622]
* test/ruby/test_settracefunc.rb: add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43237 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_settracefunc.rb')
-rw-r--r-- | test/ruby/test_settracefunc.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index 4319c8fc75..56700fc71b 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -966,4 +966,29 @@ class TestSetTraceFunc < Test::Unit::TestCase assert_equal 4, n end + + def test_tracepoint_b_return_with_lambda + n = 0 + TracePoint.new(:b_return){ + n+=1 + }.enable{ + lambda{ + return + }.call # n += 1 #=> 1 + 3.times{ + lambda{ + return # n += 3 #=> 4 + }.call + } # n += 3 #=> 7 + begin + lambda{ + raise + }.call # n += 1 #=> 8 + rescue + # ignore + end # n += 1 #=> 9 + } + + assert_equal 9, n + end end |