diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-25 23:56:55 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2016-12-25 23:56:55 +0000 |
commit | 4700e6826641fe16a1552e6476d4a2d788fbf1e2 (patch) | |
tree | 8c739fddd5fa70e173e0c6ca4d4086370fad45dd /test/ruby/test_string.rb | |
parent | da1a1f0b6ed0b0c4284684452da4f6f290be8057 (diff) | |
download | ruby-4700e6826641fe16a1552e6476d4a2d788fbf1e2.tar.gz |
string.c: CRLF in paragraph mode
* string.c (rb_str_enumerate_lines): allow CRLF to separate
paragraphs.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57185 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_string.rb')
-rw-r--r-- | test/ruby/test_string.rb | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/test/ruby/test_string.rb b/test/ruby/test_string.rb index d1da27bdb3..f2fcf3fb25 100644 --- a/test/ruby/test_string.rb +++ b/test/ruby/test_string.rb @@ -785,6 +785,11 @@ CODE assert_equal(S("hello\n\n"), res[0]) assert_equal(S("world"), res[1]) + res=[] + S("hello\r\n\r\nworld").each_line(S('')) {|x| res << x} + assert_equal(S("hello\r\n\r\n"), res[0]) + assert_equal(S("world"), res[1]) + $/ = "!" res=[] @@ -828,6 +833,11 @@ CODE assert_equal(S("world"), res[1]) res = [] + S("hello\r\n\r\nworld").each_line(S(''), chomp: true) {|x| res << x} + assert_equal(S("hello\r\n"), res[0]) + assert_equal(S("world"), res[1]) + + res = [] S("hello!world").each_line(S('!'), chomp: true) {|x| res << x} assert_equal(S("hello"), res[0]) assert_equal(S("world"), res[1]) |