зеркало из https://github.com/github/ruby.git
Test that File.read defaults to text mode
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
This commit is contained in:
Родитель
ca8daf70fa
Коммит
c433d36b5b
|
@ -104,6 +104,14 @@ describe "IO.read" do
|
||||||
str = IO.read(@fname, encoding: Encoding::ISO_8859_1)
|
str = IO.read(@fname, encoding: Encoding::ISO_8859_1)
|
||||||
str.encoding.should == Encoding::ISO_8859_1
|
str.encoding.should == Encoding::ISO_8859_1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
platform_is :windows do
|
||||||
|
it "reads the file in text mode" do
|
||||||
|
# 0x1A is CTRL+Z and is EOF in Windows text mode.
|
||||||
|
File.binwrite(@fname, "\x1Abbb")
|
||||||
|
IO.read(@fname).should.empty?
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "IO.read from a pipe" do
|
describe "IO.read from a pipe" do
|
||||||
|
|
Загрузка…
Ссылка в новой задаче