summaryrefslogtreecommitdiff
path: root/test/ruby/test_io.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/ruby/test_io.rb')
-rw-r--r--test/ruby/test_io.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index c188f2cda3..fa3b3578db 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -1105,6 +1105,18 @@ class TestIO < Test::Unit::TestCase
}
end
+ def test_copy_stream_to_duplex_io
+ result = IO.pipe {|a,w|
+ Thread.start {w.puts "yes"; w.close}
+ IO.popen([EnvUtil.rubybin, '-pe$_="#$.:#$_"'], "r+") {|b|
+ IO.copy_stream(a, b)
+ b.close_write
+ b.read
+ }
+ }
+ assert_equal("1:yes\n", result)
+ end
+
def ruby(*args)
args = ['-e', '$>.write($<.read)'] if args.empty?
ruby = EnvUtil.rubybin