diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index 80490204ca..1515767a57 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -2295,15 +2295,17 @@ class TestSetTraceFunc < Test::Unit::TestCase def test_tracepoint_opt_invokebuiltin_delegate_leave code = 'puts RubyVM::InstructionSequence.of("\x00".method(:unpack)).disasm' - out, _err, _status = EnvUtil.invoke_ruby(['-e', code], '', true) + out = EnvUtil.invoke_ruby(['-e', code], '', true).first assert_match /^0000 opt_invokebuiltin_delegate_leave /, out - events = [] - TracePoint.new(:return) do |tp| - events << [tp.event, tp.method_id] - end.enable do - "\x00".unpack("c") - end - assert_equal [[:return, :unpack]], events + event = eval(EnvUtil.invoke_ruby(['-e', <<~'EOS'], '', true).first) + set_trace_func(proc {}); set_trace_func(nil) # Is it okay that this is required? + TracePoint.new(:return) do |tp| + p [tp.event, tp.method_id] + end.enable do + "\x00".unpack("c") + end + EOS + assert_equal [:return, :unpack], event end end