diff options
author | shirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-11 12:05:19 +0000 |
---|---|---|
committer | shirosaki <shirosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2012-04-11 12:05:19 +0000 |
commit | 2f7290d4b3b1fd01f840f07c1db46929e3319db2 (patch) | |
tree | cf1ef1898ab5b0d5939e1c7bffe7cffcb82d46bb /test/ruby | |
parent | 3e130812146aadaf36e0b6a027e7f79d9e96b055 (diff) | |
download | ruby-2f7290d4b3b1fd01f840f07c1db46929e3319db2.tar.gz |
* io.c (rb_io_eof): use eof() instead of io_fillbuf(). It's because
io_unread() doesn't work properly when reading CRLF with read(length)
and mode 'r'.
[ruby-core:44189][Bug #6271]
* test/ruby/test_io_m17n.rb (TestIO_M17N#test_read_crlf_and_eof):
test for above.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35296 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_io_m17n.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index b6c6215371..be5bacf688 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -2430,4 +2430,20 @@ EOT end } end if /mswin|mingw/ =~ RUBY_PLATFORM + + def test_read_crlf_and_eof + bug6271 = '[ruby-core:44189]' + with_tmpdir { + str = "a\r\nb\r\nc\r\n" + generate_file("tmp", str) + open("tmp", "r") do |f| + i = 0 + until f.eof? + assert_equal(str[i], f.read(1), bug6271) + i += 1 + end + assert_equal(str.size, i, bug6271) + end + } + end if /mswin|mingw/ =~ RUBY_PLATFORM end |