1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Use Integer instead of Fixnum/Bignum

This commit is contained in:
Nobuyoshi Nakada 2020-12-21 01:16:26 +09:00
parent fb8f011422
commit 9c73c75624
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
144 changed files with 392 additions and 390 deletions

View file

@ -24,9 +24,9 @@ describe :numeric_step, :shared => true do
1.0.step.first(5).should == [1.0, 2.0, 3.0, 4.0, 5.0]
end
describe "when self, stop and step are Fixnums" do
it "yields only Fixnums" do
@step.call(1, 5, 1) { |x| x.should be_an_instance_of(Fixnum) }
describe "when self, stop and step are Integers" do
it "yields only Integers" do
@step.call(1, 5, 1) { |x| x.should be_an_instance_of(Integer) }
end
describe "with a positive step" do
@ -224,7 +224,7 @@ describe :numeric_step, :shared => true do
end
describe "when step is a String" do
describe "with self and stop as Fixnums" do
describe "with self and stop as Integers" do
it "raises an ArgumentError when step is a numeric representation" do
-> { @step.call(1, 5, "1") {} }.should raise_error(ArgumentError)
-> { @step.call(1, 5, "0.1") {} }.should raise_error(ArgumentError)
@ -280,7 +280,7 @@ describe :numeric_step, :shared => true do
end
describe "when step is a String" do
describe "with self and stop as Fixnums" do
describe "with self and stop as Integers" do
it "returns an Enumerator" do
@step.call(1, 5, "foo").should be_an_instance_of(Enumerator)
end
@ -296,7 +296,7 @@ describe :numeric_step, :shared => true do
describe "returned Enumerator" do
describe "size" do
describe "when step is a String" do
describe "with self and stop as Fixnums" do
describe "with self and stop as Integers" do
it "raises an ArgumentError when step is a numeric representation" do
-> { @step.call(1, 5, "1").size }.should raise_error(ArgumentError)
-> { @step.call(1, 5, "0.1").size }.should raise_error(ArgumentError)
@ -319,7 +319,7 @@ describe :numeric_step, :shared => true do
end
end
describe "when self, stop and step are Fixnums and step is positive" do
describe "when self, stop and step are Integers and step is positive" do
it "returns the difference between self and stop divided by the number of steps" do
@step.call(5, 10, 11).size.should == 1
@step.call(5, 10, 6).size.should == 1
@ -336,7 +336,7 @@ describe :numeric_step, :shared => true do
end
end
describe "when self, stop and step are Fixnums and step is negative" do
describe "when self, stop and step are Integers and step is negative" do
it "returns the difference between self and stop divided by the number of steps" do
@step.call(10, 5, -11).size.should == 1
@step.call(10, 5, -6).size.should == 1