diff options
author | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-02-21 15:38:59 +0000 |
---|---|---|
committer | eregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-02-21 15:38:59 +0000 |
commit | da7976235fbc2986925969646071bebe3702e49f (patch) | |
tree | 83bbf6a8e03cf990369feabe6c1c9d45c69f4c85 /spec/ruby/core/numeric | |
parent | b8e389a0f3226c90e96e02e6396686a3bef6a456 (diff) | |
download | ruby-da7976235fbc2986925969646071bebe3702e49f.tar.gz |
Update to ruby/spec@7a16e01
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67112 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/ruby/core/numeric')
-rw-r--r-- | spec/ruby/core/numeric/shared/step.rb | 8 | ||||
-rw-r--r-- | spec/ruby/core/numeric/step_spec.rb | 5 |
2 files changed, 13 insertions, 0 deletions
diff --git a/spec/ruby/core/numeric/shared/step.rb b/spec/ruby/core/numeric/shared/step.rb index 0fb2336bf5..066f499dc5 100644 --- a/spec/ruby/core/numeric/shared/step.rb +++ b/spec/ruby/core/numeric/shared/step.rb @@ -16,6 +16,14 @@ describe :numeric_step, :shared => true do ScratchPad.recorded.should eql [1, 2, 3, 4, 5] end + it "defaults to an infinite limit with a step size of 1 for Integers" do + 1.step.first(5).should == [1, 2, 3, 4, 5] + end + + it "defaults to an infinite limit with a step size of 1.0 for Floats" 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 1.send(@method, *@step_args.call(5, 1)) { |x| x.should be_an_instance_of(Fixnum) } diff --git a/spec/ruby/core/numeric/step_spec.rb b/spec/ruby/core/numeric/step_spec.rb index a0a4c7c9f8..12369a47a2 100644 --- a/spec/ruby/core/numeric/step_spec.rb +++ b/spec/ruby/core/numeric/step_spec.rb @@ -60,6 +60,11 @@ describe "Numeric#step" do enum.size.should == Float::INFINITY end end + + it "defaults to an infinite size" do + enum = 1.step + enum.size.should == Float::INFINITY + end end describe "type" do |