Sha256: 3a9306bb55db281191822855be676f2bcaeaaed4c3d276bc25ba15e41e04f1ce
Contents?: true
Size: 781 Bytes
Versions: 2
Compression:
Stored size: 781 Bytes
Contents
require 'test/unit' # tests that we a trace hook has access to the runtime exception Object # when it is called through a raise event class TestTracefuncRaise < Test::Unit::TestCase def test_basic tuples = [] p = Proc.new { |event, file, lineno, mid, binding, klass| tuples << klass } msg = 'this is a message' set_trace_func(p, 0x0080) begin ; x = 1/0; rescue; end begin ; raise RuntimeError, msg; rescue; end clear_trace_func assert_equal(2, tuples.size, "Wrong number of tuples captured #{tuples.inspect}") assert_equal msg, tuples[1].message assert_equal([ZeroDivisionError, RuntimeError], tuples.map{|t| t.class}, "Mismatched tuples classes in #{tuples.inspect}") end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rb-threadframe-0.39 | test/ruby/test_tracefunc_raise.rb |
rb-threadframe-0.37 | test/ruby/test_tracefunc_raise.rb |