diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-30 08:28:28 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-06-30 08:28:28 +0000 |
commit | 93446fedd3ae3efcccdeede1a5af1ec7e8b6d1cd (patch) | |
tree | d539771ef9221c64d3f81661aee7e4bf347e7891 /test | |
parent | c810ab8ff57371bf65b0bb20f268871398c8f7e8 (diff) | |
download | ruby-93446fedd3ae3efcccdeede1a5af1ec7e8b6d1cd.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')
-rw-r--r-- | test/ruby/test_io.rb | 20 |
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 } |