Commit ec04fa7e authored by Akito Mochizuki's avatar Akito Mochizuki

Modify return value of String#slice! if idx == self.size

parent ba0ddb78
......@@ -169,7 +169,7 @@ class String
if arg1 != nil && arg2 != nil
idx = arg1
idx += self.size if arg1 < 0
if idx >= 0 && idx < self.size && arg2 > 0
if idx >= 0 && idx <= self.size && arg2 > 0
str = self[idx, arg2]
else
return nil
......
......@@ -218,7 +218,7 @@ assert('String#slice!') do
assert_equal "Foo", a
a = "FooBar"
assert_nil a.slice!(6, 2)
assert_equal "", a.slice!(6, 2)
assert_equal "FooBar", a
a = "FooBar"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment