summaryrefslogtreecommitdiff
path: root/test/ruby
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby')
-rw-r--r--test/ruby/test_io.rb21
1 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index a623fd1d15..5d4ede1e4f 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2655,6 +2655,17 @@ class TestIO < Test::Unit::TestCase
}
end
+ def test_reopen_binmode
+ f1 = File.open(__FILE__)
+ f2 = File.open(__FILE__)
+ f1.binmode
+ f1.reopen(f2)
+ assert_not_operator(f1, :binmode?)
+ ensure
+ f2.close
+ f1.close
+ end
+
def make_tempfile_for_encoding
t = make_tempfile
open(t.path, "rb+:utf-8") {|f| f.puts "\u7d05\u7389bar\n"}
@@ -2685,6 +2696,16 @@ class TestIO < Test::Unit::TestCase
}
end
+ def test_reopen_encoding_from_io
+ f1 = File.open(__FILE__, "rb:UTF-16LE")
+ f2 = File.open(__FILE__, "r:UTF-8")
+ f1.reopen(f2)
+ assert_equal(Encoding::UTF_8, f1.external_encoding)
+ ensure
+ f2.close
+ f1.close
+ end
+
def test_reopen_opt_encoding
feature7103 = '[ruby-core:47806]'
make_tempfile_for_encoding {|t|