aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_io.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-30 08:28:28 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-06-30 08:28:28 +0000
commitbb5093fe0c96529a90381e8d54969334d30f3d96 (patch)
treed539771ef9221c64d3f81661aee7e4bf347e7891 /test/ruby/test_io.rb
parent2e9eba44406fe5f62e2f9752fff900818190beba (diff)
downloadruby-bb5093fe0c96529a90381e8d54969334d30f3d96.tar.gz
io.c: reopen OS encoding path
* io.c (rb_io_reopen): freopen(3) with OS encoding path. [ruby-core:69780] [Bug #11320] * win32/file.c (rb_freopen): wrapper of wchar version freopen(3). use _wfreopen_s() if available. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51069 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r--test/ruby/test_io.rb20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 8e09df48f5..51b67f37f5 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -2164,6 +2164,26 @@ End
}
end
+ bug11320 = '[ruby-core:69780] [Bug #11320]'
+ ["UTF-8", "EUC-JP", "Shift_JIS"].each do |enc|
+ define_method("test_reopen_nonascii(#{enc})") do
+ mkcdtmpdir do
+ fname = "\u{30eb 30d3 30fc}".encode(enc)
+ File.write(fname, '')
+ assert_file.exist?(fname)
+ stdin = $stdin.dup
+ begin
+ assert_nothing_raised(Errno::ENOENT, enc) {
+ $stdin.reopen(fname, 'r')
+ }
+ ensure
+ $stdin.reopen(stdin)
+ stdin.close
+ end
+ end
+ end
+ end
+
def test_foreach
a = []
IO.foreach("|" + EnvUtil.rubybin + " -e 'puts :foo; puts :bar; puts :baz'") {|x| a << x }