summaryrefslogtreecommitdiff
path: root/spec/ruby/core/tracepoint/raised_exception_spec.rb
blob: 6c81431b258ba9f1bfc366e840ae8b3ef871ede6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
require File.expand_path('../../../spec_helper', __FILE__)

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