mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 15:36:16 +02:00
* 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
This commit is contained in:
parent
d63f9e933c
commit
4599d3efd7
3 changed files with 40 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue