mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 07:26:00 +02:00
Let String#slice! return nil (#3533)
Returns `nil` instead of an empty string when non-integer number is given (to make it 2.7 compatible).
This commit is contained in:
parent
0d78390bfb
commit
f0ddbd502c
Notes:
git
2020-09-11 14:34:35 +09:00
Merged-By: soutaro <matsumoto@soutaro.com>
2 changed files with 6 additions and 1 deletions
|
@ -1588,8 +1588,10 @@ CODE
|
|||
a = S("FooBar")
|
||||
if @aref_slicebang_silent
|
||||
assert_nil( a.slice!(6) )
|
||||
assert_nil( a.slice!(6r) )
|
||||
else
|
||||
assert_raise(IndexError) { a.slice!(6) }
|
||||
assert_raise(IndexError) { a.slice!(6r) }
|
||||
end
|
||||
assert_equal(S("FooBar"), a)
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue