1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-11-30 21:26:52 +01:00
parent ab8345271e
commit 1243255c3a
174 changed files with 1780 additions and 426 deletions

View file

@ -6,48 +6,6 @@ describe "Exception.exception" do
it_behaves_like :exception_new, :exception
end
describe "Exception" do
it "is a Class" do
Exception.should be_kind_of(Class)
end
it "is a superclass of NoMemoryError" do
Exception.should be_ancestor_of(NoMemoryError)
end
it "is a superclass of ScriptError" do
Exception.should be_ancestor_of(ScriptError)
end
it "is a superclass of SignalException" do
Exception.should be_ancestor_of(SignalException)
end
it "is a superclass of Interrupt" do
SignalException.should be_ancestor_of(Interrupt)
end
it "is a superclass of StandardError" do
Exception.should be_ancestor_of(StandardError)
end
it "is a superclass of SystemExit" do
Exception.should be_ancestor_of(SystemExit)
end
it "is a superclass of SystemStackError" do
Exception.should be_ancestor_of(SystemStackError)
end
it "is a superclass of SecurityError" do
Exception.should be_ancestor_of(SecurityError)
end
it "is a superclass of EncodingError" do
Exception.should be_ancestor_of(EncodingError)
end
end
describe "Exception#exception" do
it "returns self when passed no argument" do
e = RuntimeError.new
@ -82,6 +40,18 @@ describe "Exception#exception" do
raised_second.should == caught_second
end
it "captures an exception into $!" do
exception = begin
raise
rescue RuntimeError
$!
end
exception.class.should == RuntimeError
exception.message.should == ""
exception.backtrace.first.should =~ /exception_spec/
end
class CustomArgumentError < StandardError
attr_reader :val
def initialize(val)