ruby-changes:72834
From: Alan <ko1@a...>
Date: Sat, 6 Aug 2022 03:34:25 +0900 (JST)
Subject: [ruby-changes:72834] c433d36b5b (master): Test that File.read defaults to text mode
https://git.ruby-lang.org/ruby.git/commit/?id=c433d36b5b From c433d36b5bd0b6a649a0c4112a9868bd5190cbc6 Mon Sep 17 00:00:00 2001 From: Alan Wu <XrXr@u...> Date: Wed, 3 Aug 2022 11:12:18 -0400 Subject: Test that File.read defaults to text mode Co-authored-by: Nobuyoshi Nakada <nobu@r...> --- spec/ruby/core/io/read_spec.rb | 8 ++++++++ 1 file changed, 8 insertions(+) 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 https://github.com/ruby/ruby/blob/trunk/spec/ruby/core/io/read_spec.rb#L104 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 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/