aboutsummaryrefslogtreecommitdiffstats
path: root/spec/ruby/core/array/fill_spec.rb
diff options
context:
space:
mode:
Diffstat (limited to 'spec/ruby/core/array/fill_spec.rb')
-rw-r--r--spec/ruby/core/array/fill_spec.rb7
1 files changed, 7 insertions, 0 deletions
diff --git a/spec/ruby/core/array/fill_spec.rb b/spec/ruby/core/array/fill_spec.rb
index 6745bc8d09..8f0814a5da 100644
--- a/spec/ruby/core/array/fill_spec.rb
+++ b/spec/ruby/core/array/fill_spec.rb
@@ -324,4 +324,11 @@ describe "Array#fill with (filler, range)" do
[1, 2, 3, 4].fill(eval("(3...)")) { |x| x + 2 }.should == [1, 2, 3, 5]
end
end
+
+ ruby_version_is "2.7" do
+ it "works with beginless ranges" do
+ [1, 2, 3, 4].fill('x', eval("(..2)")).should == ["x", "x", "x", 4]
+ [1, 2, 3, 4].fill(eval("(...2)")) { |x| x + 2 }.should == [2, 3, 3, 4]
+ end
+ end
end