summaryrefslogtreecommitdiff
path: root/spec/ruby/core/numeric
diff options
context:
space:
mode:
authorBenoit Daloze <eregontp@gmail.com>2021-11-29 15:50:28 +0100
committerBenoit Daloze <eregontp@gmail.com>2021-11-29 15:50:28 +0100
commit67a1e2258974df4b597d019739595c18fbb9a7c1 (patch)
tree992ad4fc0fc08a6af8f04373703a339f957eb143 /spec/ruby/core/numeric
parente6d93a27afa058319e6dad093bbef637e49fce47 (diff)
Update to ruby/spec@7f22a0b
Diffstat (limited to 'spec/ruby/core/numeric')
-rw-r--r--spec/ruby/core/numeric/clone_spec.rb7
-rw-r--r--spec/ruby/core/numeric/quo_spec.rb9
2 files changed, 16 insertions, 0 deletions
diff --git a/spec/ruby/core/numeric/clone_spec.rb b/spec/ruby/core/numeric/clone_spec.rb
index e3bf0a9e7c..c3b06ca0c9 100644
--- a/spec/ruby/core/numeric/clone_spec.rb
+++ b/spec/ruby/core/numeric/clone_spec.rb
@@ -22,4 +22,11 @@ describe "Numeric#clone" do
it "raises ArgumentError if passed freeze: false" do
-> { 1.clone(freeze: false) }.should raise_error(ArgumentError, /can't unfreeze/)
end
+
+ ruby_version_is "3.0" do
+ it "does not change frozen status if passed freeze: nil" do
+ value = 1
+ value.clone(freeze: nil).should equal(value)
+ end
+ end
end
diff --git a/spec/ruby/core/numeric/quo_spec.rb b/spec/ruby/core/numeric/quo_spec.rb
index 5c952b11a9..b4a23fd476 100644
--- a/spec/ruby/core/numeric/quo_spec.rb
+++ b/spec/ruby/core/numeric/quo_spec.rb
@@ -52,4 +52,13 @@ describe "Numeric#quo" do
obj.quo(19).should == 1.quo(20)
end
+
+ it "raises a ZeroDivisionError if the given argument is zero and not a Float" do
+ -> { 1.quo(0) }.should raise_error(ZeroDivisionError)
+ end
+
+ it "returns infinity if the given argument is zero and is a Float" do
+ (1.quo(0.0)).to_s.should == 'Infinity'
+ (-1.quo(0.0)).to_s.should == '-Infinity'
+ end
end