summaryrefslogtreecommitdiff
path: root/test/ruby/test_io.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r--test/ruby/test_io.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index a6df5c8b08..a49fd0130e 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -3630,15 +3630,27 @@ __END__
end
def test_open_flag_binary
+ binary_enc = Encoding.find("BINARY")
make_tempfile do |t|
open(t.path, File::RDONLY, flags: File::BINARY) do |f|
assert_equal true, f.binmode?
+ assert_equal binary_enc, f.external_encoding
end
open(t.path, 'r', flags: File::BINARY) do |f|
assert_equal true, f.binmode?
+ assert_equal binary_enc, f.external_encoding
end
open(t.path, mode: 'r', flags: File::BINARY) do |f|
assert_equal true, f.binmode?
+ assert_equal binary_enc, f.external_encoding
+ end
+ open(t.path, File::RDONLY|File::BINARY) do |f|
+ assert_equal true, f.binmode?
+ assert_equal binary_enc, f.external_encoding
+ end
+ open(t.path, File::RDONLY|File::BINARY, autoclose: true) do |f|
+ assert_equal true, f.binmode?
+ assert_equal binary_enc, f.external_encoding
end
end
end if File::BINARY != 0