Bug #6271 ยป read_eof.patch
| io.c | ||
|---|---|---|
|
if (READ_CHAR_PENDING(fptr)) return Qfalse;
|
||
|
if (READ_DATA_PENDING(fptr)) return Qfalse;
|
||
|
READ_CHECK(fptr);
|
||
|
#if defined(RUBY_TEST_CRLF_ENVIRONMENT) || defined(_WIN32)
|
||
|
if (!NEED_READCONV(fptr) && NEED_NEWLINE_DECORATOR_ON_READ(fptr)) {
|
||
|
return eof(fptr->fd) ? Qtrue : Qfalse;
|
||
|
}
|
||
|
#endif
|
||
|
if (io_fillbuf(fptr) < 0) {
|
||
|
return Qtrue;
|
||
|
}
|
||
| test/ruby/test_io_m17n.rb | ||
|---|---|---|
|
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))
|
||
|
i += 1
|
||
|
end
|
||
|
assert_equal(str.size, i)
|
||
|
end
|
||
|
}
|
||
|
end if /mswin|mingw/ =~ RUBY_PLATFORM
|
||
|
end
|
||