From 1891b5e627e890e36e134198313276fac573427d Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 18 Aug 2008 15:35:21 +0000 Subject: * io.c (rb_io_check_readable): side effect for STDIN removed. (rb_io_external_encoding): ditto. git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@18695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io_m17n.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/ruby') diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index b059f70ff..fbf386548 100644 --- a/test/ruby/test_io_m17n.rb +++ b/test/ruby/test_io_m17n.rb @@ -1,6 +1,7 @@ require 'test/unit' require 'tmpdir' require 'timeout' +require_relative 'envutil' class TestIO_M17N < Test::Unit::TestCase ENCS = [ @@ -662,5 +663,23 @@ EOT } end + def test_stdin_external_encoding_with_reopen + with_tmpdir { + open("tst", "w+") {|f| + pid = spawn(EnvUtil.rubybin, '-e', <<-'End', 10=>f) + io = IO.new(10, "r+") + STDIN.reopen(io) + STDIN.external_encoding + STDIN.write "\u3042" + STDIN.flush + End + Process.wait pid + f.rewind + result = f.read.force_encoding("ascii-8bit") + assert_equal("\u3042".force_encoding("ascii-8bit"), result) + } + } + end + end -- cgit