diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-23 07:09:07 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-09-23 07:09:07 +0000 |
commit | 8c59fdb8d8f3144570019ee501e508a6ebd9575b (patch) | |
tree | 4423bd9c236083a4a020a444b9b1f4dd860b0349 /test/ruby | |
parent | e1be1d0c3815be2819f525e3c1d1ec34ccdc398b (diff) | |
download | ruby-8c59fdb8d8f3144570019ee501e508a6ebd9575b.tar.gz |
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
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_string.rb | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index 08dc806380..b1f3c3cfcb 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -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(" "))) |