diff options
Diffstat (limited to 'spec/ruby/core/exception/dup_spec.rb')
-rw-r--r-- | spec/ruby/core/exception/dup_spec.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/core/exception/dup_spec.rb b/spec/ruby/core/exception/dup_spec.rb index 3ad1fc063b..c7fcd280dd 100644 --- a/spec/ruby/core/exception/dup_spec.rb +++ b/spec/ruby/core/exception/dup_spec.rb @@ -58,4 +58,17 @@ describe "Exception#dup" do @obj.dup.backtrace.should == @obj.backtrace end + + it "does copy the cause" do + begin + raise StandardError, "the cause" + rescue StandardError => cause + begin + raise RuntimeError, "the consequence" + rescue RuntimeError => e + e.cause.should equal(cause) + e.dup.cause.should equal(cause) + end + end + end end |