summaryrefslogtreecommitdiff
path: root/spec/ruby/core/string/shared
diff options
context:
space:
mode:
authorBenoit Daloze <[email protected]>2021-01-28 17:08:57 +0100
committerBenoit Daloze <[email protected]>2021-01-28 17:08:57 +0100
commit2e32b919b4f2f5b7f2e1509d6fa985526ef1f61c (patch)
treeaedadac3c99ca0097c2bbeaa95830332d6fb9971 /spec/ruby/core/string/shared
parent1b377b32c8616f85c0a97e68758c5c2db83f2169 (diff)
Update to ruby/spec@8cafaa5
Diffstat (limited to 'spec/ruby/core/string/shared')
-rw-r--r--spec/ruby/core/string/shared/slice.rb10
1 files changed, 10 insertions, 0 deletions
diff --git a/spec/ruby/core/string/shared/slice.rb b/spec/ruby/core/string/shared/slice.rb
index 69997b7c1d..a674e0b6ef 100644
--- a/spec/ruby/core/string/shared/slice.rb
+++ b/spec/ruby/core/string/shared/slice.rb
@@ -335,6 +335,16 @@ describe :string_slice_range, shared: true do
"hello there".send(@method, eval("(-4...)")).should == "here"
end
end
+
+ ruby_version_is "2.7" do
+ it "works with beginless ranges" do
+ "hello there".send(@method, eval("(..5)")).should == "hello "
+ "hello there".send(@method, eval("(...5)")).should == "hello"
+ "hello there".send(@method, eval("(..-4)")).should == "hello th"
+ "hello there".send(@method, eval("(...-4)")).should == "hello t"
+ "hello there".send(@method, eval("(...nil)")).should == "hello there"
+ end
+ end
end
describe :string_slice_regexp, shared: true do