aboutsummaryrefslogtreecommitdiffstats
path: root/test/ruby/test_io.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-25 12:23:42 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-11-25 12:23:42 +0000
commit7d92e5cf730596429fd33ce7a580112b28528662 (patch)
treeddb7a039269e625ad58f4bdc8b9caa2191055f32 /test/ruby/test_io.rb
parent012368007f0a7fce81a0083c96aa549c21141d05 (diff)
downloadruby-7d92e5cf730596429fd33ce7a580112b28528662.tar.gz
io.c: try to_io first
* io.c (copy_stream_body): try to_io conversion before read, readpartial, and write methods. [ruby-dev:49008] [Bug #11199] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@52750 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
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 12c4abdbe4..bb878ea148 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -3,6 +3,7 @@ require 'test/unit'
require 'tmpdir'
require "fcntl"
require 'io/nonblock'
+require 'pathname'
require 'socket'
require 'stringio'
require 'timeout'
@@ -888,6 +889,17 @@ class TestIO < Test::Unit::TestCase
dst.close!
end
+ def test_copy_stream_pathname_to_pathname
+ bug11199 = '[ruby-dev:49008] [Bug #11199]'
+ mkcdtmpdir {
+ File.open("src", "w") {|f| f << "ok" }
+ src = Pathname.new("src")
+ dst = Pathname.new("dst")
+ IO.copy_stream(src, dst)
+ assert_equal("ok", IO.read("dst"), bug11199)
+ }
+ end
+
def test_copy_stream_write_in_binmode
bug8767 = '[ruby-core:56518] [Bug #8767]'
mkcdtmpdir {