mirror of
https://github.com/ruby/ruby.git
synced 2025-08-28 15:36:16 +02:00
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
This commit is contained in:
parent
091f99b4b9
commit
10bd48e402
2 changed files with 47 additions and 17 deletions
|
@ -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=[]
|
||||
|
@ -827,6 +832,11 @@ CODE
|
|||
assert_equal(S("hello\n"), res[0])
|
||||
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])
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue