summaryrefslogtreecommitdiff
path: root/spec/ruby/core/exception
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-27 13:12:39 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-01-27 13:12:39 +0000
commit42921458ff7eacd1ef614c3e67596c75ccd0a1d4 (patch)
tree710c40988e51715f84a12c3295162b1c5697bf51 /spec/ruby/core/exception
parenta53ee2136ff59ebc54ae6c98a500765bc3d13d44 (diff)
Update to ruby/spec@e57f49c
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66929 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/exception')
-rw-r--r--spec/ruby/core/exception/exception_spec.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/spec/ruby/core/exception/exception_spec.rb b/spec/ruby/core/exception/exception_spec.rb
index 750c0ae452..3a01366920 100644
--- a/spec/ruby/core/exception/exception_spec.rb
+++ b/spec/ruby/core/exception/exception_spec.rb
@@ -66,6 +66,22 @@ describe "Exception#exception" do
e2.message.should == "message"
end
+ it "when raised will be rescued as the new exception" do
+ begin
+ begin
+ raised_first = StandardError.new('first')
+ raise raised_first
+ rescue => caught_first
+ raised_second = raised_first.exception('second')
+ raise raised_second
+ end
+ rescue => caught_second
+ end
+
+ raised_first.should == caught_first
+ raised_second.should == caught_second
+ end
+
class CustomArgumentError < StandardError
attr_reader :val
def initialize(val)