mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 15:36:16 +02:00
dup String#split return value
* string.c (rb_str_split): return duplicated receiver, when no splits. patched by tompng (tomoya ishida) in [ruby-core:82911], and the test case by Seiei Miyagi <hanachin@gmail.com>. [Bug#13925] [Fix GH-1705] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60002 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e1be1d0c38
commit
8c59fdb8d8
2 changed files with 6 additions and 1 deletions
|
@ -1686,6 +1686,11 @@ CODE
|
|||
}
|
||||
end
|
||||
|
||||
def test_split_dupped
|
||||
s = "abc"
|
||||
s.split("b", 1).map(&:upcase!)
|
||||
assert_equal("abc", s)
|
||||
end
|
||||
def test_squeeze
|
||||
assert_equal(S("abc"), S("aaabbbbccc").squeeze)
|
||||
assert_equal(S("aa bb cc"), S("aa bb cc").squeeze(S(" ")))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue