summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorAlan Wu <XrXr@users.noreply.github.com>2022-08-03 11:12:18 -0400
committerAlan Wu <XrXr@users.noreply.github.com>2022-08-05 14:34:08 -0400
commitc433d36b5bd0b6a649a0c4112a9868bd5190cbc6 (patch)
treea8929b4b4b88b9aaac2285edcb2cabaaa776691f /spec
parentca8daf70fa7045aa1e505514497d1ac4720a6b16 (diff)
Test that File.read defaults to text mode
Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/6212
Diffstat (limited to 'spec')
-rw-r--r--spec/ruby/core/io/read_spec.rb8
1 files changed, 8 insertions, 0 deletions
diff --git a/spec/ruby/core/io/read_spec.rb b/spec/ruby/core/io/read_spec.rb
index 841e693f37..28cab13340 100644
--- a/spec/ruby/core/io/read_spec.rb
+++ b/spec/ruby/core/io/read_spec.rb
@@ -104,6 +104,14 @@ describe "IO.read" do
str = IO.read(@fname, encoding: Encoding::ISO_8859_1)
str.encoding.should == Encoding::ISO_8859_1
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
describe "IO.read from a pipe" do