diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-11 06:45:29 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-03-11 06:45:29 +0000 |
commit | d27ee2112ff81d4d445a2a9bd6df538aca16f1fd (patch) | |
tree | fd3d85018121dc62635c163ce12ac4cada200ec2 /test | |
parent | ce5590fc9f6d9ad728b0592a18311022807e61d4 (diff) |
merge revision(s) 67188: [Backport #15642]
io.c: chomp CR at the end of read buffer
* io.c (rb_io_getline_fast): chomp CR followed by LF but separated
by the read buffer boundary. [ruby-core:91707] [Bug #15642]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_6@67207 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_io.rb | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 2fc28f67a9..92fba2c04e 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -233,6 +233,19 @@ class TestIO < Test::Unit::TestCase assert_nil r.gets r.close end) + + (0..3).each do |i| + pipe(proc do |w| + w.write("a" * ((4096 << i) - 4), "\r\n" "a\r\n") + w.close + end, + proc do |r| + r.gets + assert_equal "a", r.gets(chomp: true) + assert_nil r.gets + r.close + end) + end end def test_gets_chomp_rs_nil |