summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-30 02:28:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-03-30 02:28:02 +0000
commitefbfd9027282e6f82f41edd32a1732d4a07e90a3 (patch)
tree508a152ef27c25b7a2691aee0a43781935ede032 /test
parentbe6ef3502e5cbcad2f93bcef07a23a290499fd28 (diff)
io.c: use read/write methods if possible
* io.c (copy_stream_body): use the arguments without conversion if having read, readpartial, and write methods, than conversion by to_path method. [ruby-core:68676] [Bug #11015] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50118 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index 81b99d55d1..c37d14c47f 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -873,6 +873,21 @@ class TestIO < Test::Unit::TestCase
}
end
+ def test_copy_stream_strio_to_tempfile
+ bug11015 = '[ruby-core:68676] [Bug #11015]'
+ # StringIO to Tempfile
+ src = StringIO.new("abcd")
+ dst = Tempfile.new("baz")
+ ret = IO.copy_stream(src, dst)
+ assert_equal(4, ret)
+ pos = dst.pos
+ dst.rewind
+ assert_equal("abcd", dst.read)
+ assert_equal(4, pos, bug11015)
+ ensure
+ dst.close!
+ end
+
def test_copy_stream_write_in_binmode
bug8767 = '[ruby-core:56518] [Bug #8767]'
mkcdtmpdir {