aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/tracepoint/raised_exception_spec.rb
blob: 450717b958da7aa289cf79c3b42bda4b258af1f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require_relative '../../spec_helper'

describe 'TracePoint#raised_exception' do
  it 'returns value from exception raised on the :raise event' do
    raised_exception, error_result = nil
    trace = TracePoint.new(:raise) { |tp| raised_exception = tp.raised_exception }
    trace.enable do
      begin
        raise StandardError
      rescue => e
        error_result = e
      end
      raised_exception.should equal(error_result)
    end
  end
end