1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2021-07-29 22:11:21 +02:00
parent 15d05f8120
commit 6998d75824
186 changed files with 3956 additions and 3339 deletions

View file

@ -316,13 +316,11 @@ describe "Array#fill with (filler, range)" do
-> { [].fill('a', obj..obj) }.should raise_error(TypeError)
end
ruby_version_is "2.6" do
it "works with endless ranges" do
[1, 2, 3, 4].fill('x', eval("(1..)")).should == [1, 'x', 'x', 'x']
[1, 2, 3, 4].fill('x', eval("(3...)")).should == [1, 2, 3, 'x']
[1, 2, 3, 4].fill(eval("(1..)")) { |x| x + 2 }.should == [1, 3, 4, 5]
[1, 2, 3, 4].fill(eval("(3...)")) { |x| x + 2 }.should == [1, 2, 3, 5]
end
it "works with endless ranges" do
[1, 2, 3, 4].fill('x', eval("(1..)")).should == [1, 'x', 'x', 'x']
[1, 2, 3, 4].fill('x', eval("(3...)")).should == [1, 2, 3, 'x']
[1, 2, 3, 4].fill(eval("(1..)")) { |x| x + 2 }.should == [1, 3, 4, 5]
[1, 2, 3, 4].fill(eval("(3...)")) { |x| x + 2 }.should == [1, 2, 3, 5]
end
ruby_version_is "2.7" do