mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Update to ruby/spec@35a9fba
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@66888 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
58573c33e4
commit
6204e0804b
147 changed files with 2728 additions and 21522 deletions
|
@ -100,4 +100,46 @@ describe :kernel_Rational, shared: true do
|
|||
lambda { Rational(1, :sym) }.should raise_error(TypeError)
|
||||
end
|
||||
end
|
||||
|
||||
ruby_version_is "2.6" do
|
||||
describe "when passed exception: false" do
|
||||
describe "and [non-Numeric]" do
|
||||
it "swallows an error" do
|
||||
Rational(:sym, exception: false).should == nil
|
||||
Rational("abc", exception: false).should == nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "and [non-Numeric, Numeric]" do
|
||||
it "swallows an error" do
|
||||
Rational(:sym, 1, exception: false).should == nil
|
||||
Rational("abc", 1, exception: false).should == nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "and [anything, non-Numeric]" do
|
||||
it "swallows an error" do
|
||||
Rational(:sym, :sym, exception: false).should == nil
|
||||
Rational("abc", :sym, exception: false).should == nil
|
||||
end
|
||||
end
|
||||
|
||||
describe "and non-Numeric String arguments" do
|
||||
it "swallows an error" do
|
||||
Rational("a", "b", exception: false).should == nil
|
||||
Rational("a", 0, exception: false).should == nil
|
||||
Rational(0, "b", exception: false).should == nil
|
||||
end
|
||||
end
|
||||
|
||||
ruby_bug "#15525", "2.6"..."2.6.1" do
|
||||
describe "and nil arguments" do
|
||||
it "swallows an error" do
|
||||
Rational(nil, exception: false).should == nil
|
||||
Rational(nil, nil, exception: false).should == nil
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue