mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
TracePoint#enable, #disable: Don't yield any argument. [Bug #14057]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60437 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
464cda55c5
commit
7e3bd6646c
2 changed files with 10 additions and 4 deletions
|
@ -639,16 +639,19 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
|||
|
||||
def test_tracepoint_enable
|
||||
ary = []
|
||||
args = nil
|
||||
trace = TracePoint.new(:call){|tp|
|
||||
next if !target_thread?
|
||||
ary << tp.method_id
|
||||
}
|
||||
foo
|
||||
trace.enable{
|
||||
trace.enable{|*a|
|
||||
args = a
|
||||
foo
|
||||
}
|
||||
foo
|
||||
assert_equal([:foo], ary)
|
||||
assert_equal([], args)
|
||||
|
||||
trace = TracePoint.new{}
|
||||
begin
|
||||
|
@ -663,17 +666,20 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
|||
|
||||
def test_tracepoint_disable
|
||||
ary = []
|
||||
args = nil
|
||||
trace = TracePoint.trace(:call){|tp|
|
||||
next if !target_thread?
|
||||
ary << tp.method_id
|
||||
}
|
||||
foo
|
||||
trace.disable{
|
||||
trace.disable{|*a|
|
||||
args = a
|
||||
foo
|
||||
}
|
||||
foo
|
||||
trace.disable
|
||||
assert_equal([:foo, :foo], ary)
|
||||
assert_equal([], args)
|
||||
|
||||
trace = TracePoint.new{}
|
||||
trace.enable{
|
||||
|
|
|
@ -1088,7 +1088,7 @@ tracepoint_enable_m(VALUE tpval)
|
|||
rb_tracepoint_enable(tpval);
|
||||
|
||||
if (rb_block_given_p()) {
|
||||
return rb_ensure(rb_yield, Qnil,
|
||||
return rb_ensure(rb_yield, Qundef,
|
||||
previous_tracing ? rb_tracepoint_enable : rb_tracepoint_disable,
|
||||
tpval);
|
||||
}
|
||||
|
@ -1139,7 +1139,7 @@ tracepoint_disable_m(VALUE tpval)
|
|||
rb_tracepoint_disable(tpval);
|
||||
|
||||
if (rb_block_given_p()) {
|
||||
return rb_ensure(rb_yield, Qnil,
|
||||
return rb_ensure(rb_yield, Qundef,
|
||||
previous_tracing ? rb_tracepoint_enable : rb_tracepoint_disable,
|
||||
tpval);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue