summaryrefslogtreecommitdiff
path: root/spec/ruby/core/exception/set_backtrace_spec.rb
blob: 2cd93326ecfb36a962b4b9efff7ecfa4b256f3d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
require_relative '../../spec_helper'
require_relative 'fixtures/common'
require_relative 'shared/set_backtrace'

describe "Exception#set_backtrace" do
  it "allows the user to set the backtrace from a rescued exception" do
    bt  = ExceptionSpecs::Backtrace.backtrace
    err = RuntimeError.new
    err.backtrace.should == nil
    err.backtrace_locations.should == nil

    err.set_backtrace bt

    err.backtrace.should == bt
    err.backtrace_locations.should == nil
  end

  it_behaves_like :exception_set_backtrace, -> backtrace {
    err = RuntimeError.new
    err.set_backtrace(backtrace)
    err
  }
end