Skip to content

Commit 1a5805e

Browse files
committed
Add missing specs for String#slice with negative bignum arguments
1 parent 3b0fb88 commit 1a5805e

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

spec/ruby/core/string/shared/slice.rb

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,11 @@
159159
-> { "hello".send(@method, 0, bignum_value) }.should raise_error(RangeError)
160160
end
161161

162+
it "raises a RangeError if the index or length is too small" do
163+
-> { "hello".send(@method, -bignum_value, 1) }.should raise_error(RangeError)
164+
-> { "hello".send(@method, 0, -bignum_value) }.should raise_error(RangeError)
165+
end
166+
162167
it "returns String instances" do
163168
s = StringSpecs::MyString.new("hello")
164169
s.send(@method, 0,0).should be_an_instance_of(String)

0 commit comments

Comments
 (0)