1require 'dtrace/helper' 2 3module DTrace 4 class TestRaise < TestCase 5 def test_raise 6 probe = <<-eoprobe 7ruby$target:::raise 8{ 9 printf("%s %s %d\\n", copyinstr(arg0), copyinstr(arg1), arg2); 10} 11 eoprobe 12 trap_probe(probe, program) { |dpath, rbpath, saw| 13 saw = saw.map(&:split).find_all { |_, source_file, _| 14 source_file == rbpath 15 } 16 assert_equal 10, saw.length 17 saw.each do |klass, _, source_line| 18 assert_equal 'RuntimeError', klass 19 assert_equal '1', source_line 20 end 21 } 22 end 23 24 private 25 def program 26 '10.times { raise rescue nil }' 27 end 28 end 29end if defined?(DTrace::TestCase) 30