зеркало из https://github.com/github/ruby.git
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:
Родитель
464cda55c5
Коммит
7e3bd6646c
|
@ -639,16 +639,19 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_tracepoint_enable
|
def test_tracepoint_enable
|
||||||
ary = []
|
ary = []
|
||||||
|
args = nil
|
||||||
trace = TracePoint.new(:call){|tp|
|
trace = TracePoint.new(:call){|tp|
|
||||||
next if !target_thread?
|
next if !target_thread?
|
||||||
ary << tp.method_id
|
ary << tp.method_id
|
||||||
}
|
}
|
||||||
foo
|
foo
|
||||||
trace.enable{
|
trace.enable{|*a|
|
||||||
|
args = a
|
||||||
foo
|
foo
|
||||||
}
|
}
|
||||||
foo
|
foo
|
||||||
assert_equal([:foo], ary)
|
assert_equal([:foo], ary)
|
||||||
|
assert_equal([], args)
|
||||||
|
|
||||||
trace = TracePoint.new{}
|
trace = TracePoint.new{}
|
||||||
begin
|
begin
|
||||||
|
@ -663,17 +666,20 @@ class TestSetTraceFunc < Test::Unit::TestCase
|
||||||
|
|
||||||
def test_tracepoint_disable
|
def test_tracepoint_disable
|
||||||
ary = []
|
ary = []
|
||||||
|
args = nil
|
||||||
trace = TracePoint.trace(:call){|tp|
|
trace = TracePoint.trace(:call){|tp|
|
||||||
next if !target_thread?
|
next if !target_thread?
|
||||||
ary << tp.method_id
|
ary << tp.method_id
|
||||||
}
|
}
|
||||||
foo
|
foo
|
||||||
trace.disable{
|
trace.disable{|*a|
|
||||||
|
args = a
|
||||||
foo
|
foo
|
||||||
}
|
}
|
||||||
foo
|
foo
|
||||||
trace.disable
|
trace.disable
|
||||||
assert_equal([:foo, :foo], ary)
|
assert_equal([:foo, :foo], ary)
|
||||||
|
assert_equal([], args)
|
||||||
|
|
||||||
trace = TracePoint.new{}
|
trace = TracePoint.new{}
|
||||||
trace.enable{
|
trace.enable{
|
||||||
|
|
|
@ -1088,7 +1088,7 @@ tracepoint_enable_m(VALUE tpval)
|
||||||
rb_tracepoint_enable(tpval);
|
rb_tracepoint_enable(tpval);
|
||||||
|
|
||||||
if (rb_block_given_p()) {
|
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,
|
previous_tracing ? rb_tracepoint_enable : rb_tracepoint_disable,
|
||||||
tpval);
|
tpval);
|
||||||
}
|
}
|
||||||
|
@ -1139,7 +1139,7 @@ tracepoint_disable_m(VALUE tpval)
|
||||||
rb_tracepoint_disable(tpval);
|
rb_tracepoint_disable(tpval);
|
||||||
|
|
||||||
if (rb_block_given_p()) {
|
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,
|
previous_tracing ? rb_tracepoint_enable : rb_tracepoint_disable,
|
||||||
tpval);
|
tpval);
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче