From f11b5771a944bd9693d3508e8f29abbf83e62287 Mon Sep 17 00:00:00 2001 From: Brandur Date: Sun, 17 Nov 2013 11:51:41 -0800 Subject: [PATCH] Tests for a_call + a_return --- test/ruby/test_settracefunc.rb | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/test/ruby/test_settracefunc.rb b/test/ruby/test_settracefunc.rb index c982e57..f5181fe 100644 --- a/test/ruby/test_settracefunc.rb +++ b/test/ruby/test_settracefunc.rb @@ -999,4 +999,46 @@ def test_isolated_raise_in_trace 1.times {break} END end + + def test_a_call + events = [] + TracePoint.new(:a_call){|tp| + events << tp.event + }.enable{ + 1.times{ + 3 + } + method_for_test_tracepoint_block{ + 4 + } + } + assert_equal([ + :b_call, + :c_call, + :b_call, + :call, + :b_call, + ], events) + end + + def test_a_return + events = [] + TracePoint.new(:a_return){|tp| + events << tp.event + }.enable{ + 1.times{ + 3 + } + method_for_test_tracepoint_block{ + 4 + } + } + assert_equal([ + :b_return, + :c_return, + :b_return, + :return, + :b_return + ], events) + end end -- 1.8.4