summaryrefslogtreecommitdiff
path: root/spec/ruby/core/exception/set_backtrace_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/exception/set_backtrace_spec.rb')
-rw-r--r--spec/ruby/core/exception/set_backtrace_spec.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/ruby/core/exception/set_backtrace_spec.rb b/spec/ruby/core/exception/set_backtrace_spec.rb
new file mode 100644
index 0000000000..2cd93326ec
--- /dev/null
+++ b/spec/ruby/core/exception/set_backtrace_spec.rb
@@ -0,0 +1,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