Skip to content

Commit

Permalink
Add example with step 1
Browse files Browse the repository at this point in the history
  • Loading branch information
eregon authored and lxxxvi committed Oct 8, 2021
1 parent 9d58f70 commit b5c2c20
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions core/array/shared/slice.rb
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ def to.to_int() -2 end
ruby_version_is "3.0" do
it "can be sliced with Enumerator::ArithmeticSequence" do
a = [0, 1, 2, 3, 4, 5]
a.send(@method, eval("(0..).step(1)")).should == [0, 1, 2, 3, 4, 5]
a.send(@method, eval("(0..).step(2)")).should == [0, 2, 4]
a.send(@method, eval("(0..).step(3)")).should == [0, 3]
a.send(@method, eval("(0..).step(10)")).should == [0]
Expand Down

0 comments on commit b5c2c20

Please sign in to comment.