diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-18 15:35:21 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-08-18 15:35:21 +0000 |
commit | febc4b9923c6a20539e615b99eb59be7e2c43189 (patch) | |
tree | e3594496d49b4c3eb7bf4874853eb1a344888864 /test | |
parent | 1b821cb4a32b40ba6392abbba6c941aceb47e54d (diff) | |
download | ruby-febc4b9923c6a20539e615b99eb59be7e2c43189.tar.gz |
* io.c (rb_io_check_readable): side effect for STDIN removed.
(rb_io_external_encoding): ditto.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@18695 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_io_m17n.rb | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/test/ruby/test_io_m17n.rb b/test/ruby/test_io_m17n.rb index b059f70ff3..fbf386548a 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 |