diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-29 12:19:03 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-29 12:19:03 +0000 |
commit | 634a48c5c1eba9d0d663759faf0c2156007a403a (patch) | |
tree | df4dce75da3828d61b469e95f6cd2fb606c5970c /test | |
parent | 18640bf9f0fd60dfa116a65558af6e9314cda491 (diff) |
string.c: chomp rs at the end
* string.c (rb_str_enumerate_lines): should chomp record separator
only, but not a newline, at the end of the receiver as well as
middle, if the separator is given.
[ruby-core:84552] [Bug #14257]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61513 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_string.rb | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index e88746dc55..b0c6e447eb 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -1119,6 +1119,10 @@ CODE res = [] S("\r\n").each_line(chomp: true) {|x| res << x} assert_equal([S("")], res) + + res = [] + S("a\n b\n").each_line(" ", chomp: true) {|x| res << x} + assert_equal([S("a\n"), S("b\n")], res) end def test_lines |