diff options
author | Benoit Daloze <eregontp@gmail.com> | 2020-01-28 20:47:48 +0100 |
---|---|---|
committer | Benoit Daloze <eregontp@gmail.com> | 2020-01-28 20:47:48 +0100 |
commit | 809f0b8a1357f14f9645210d4812f4400c8d397e (patch) | |
tree | 7ce6192f94b1dc4b004798aa5d0c4d6bac02577f /spec/ruby/core/array/fill_spec.rb | |
parent | ed377cc9aaf1ccbede19ddc6c464f5fbf3cabc34 (diff) | |
download | ruby-809f0b8a1357f14f9645210d4812f4400c8d397e.tar.gz |
Update to ruby/spec@f8a2d54
Diffstat (limited to 'spec/ruby/core/array/fill_spec.rb')
-rw-r--r-- | spec/ruby/core/array/fill_spec.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/spec/ruby/core/array/fill_spec.rb b/spec/ruby/core/array/fill_spec.rb index 1c1beef25e..0f44d3c010 100644 --- a/spec/ruby/core/array/fill_spec.rb +++ b/spec/ruby/core/array/fill_spec.rb @@ -314,4 +314,13 @@ describe "Array#fill with (filler, range)" do def obj.<=>(rhs); rhs == self ? 0 : nil end -> { [].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 + end end |