tests-for-a-call-and-a-return.patch

Brandur Leach, 11/18/2013 05:02 AM

Download (1.26 KB)

View differences:

test/ruby/test_settracefunc.rb
999 999
    1.times {break}
1000 1000
    END
1001 1001
  end
1002

  
1003
  def test_a_call
1004
    events = []
1005
    TracePoint.new(:a_call){|tp|
1006
      events << tp.event
1007
    }.enable{
1008
      1.times{
1009
        3
1010
      }
1011
      method_for_test_tracepoint_block{
1012
        4
1013
      }
1014
    }
1015
    assert_equal([
1016
      :b_call,
1017
      :c_call,
1018
      :b_call,
1019
      :call,
1020
      :b_call,
1021
    ], events)
1022
  end
1023

  
1024
  def test_a_return
1025
    events = []
1026
    TracePoint.new(:a_return){|tp|
1027
      events << tp.event
1028
    }.enable{
1029
      1.times{
1030
        3
1031
      }
1032
      method_for_test_tracepoint_block{
1033
        4
1034
      }
1035
    }
1036
    assert_equal([
1037
      :b_return,
1038
      :c_return,
1039
      :b_return,
1040
      :return,
1041
      :b_return
1042
    ], events)
1043
  end
1002 1044
end
1003
-