aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-23 23:19:14 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-10-23 23:19:14 +0000
commita28fe36c89cca3ae402f657f6bb8ebf038c23175 (patch)
treeea39ef54005559c4f53cab42094b9402f2e35653 /test
parentb062e60805c9be8c6267d3ad17bd5fbd0c0c8a83 (diff)
downloadruby-a28fe36c89cca3ae402f657f6bb8ebf038c23175.tar.gz
* io.c (copy_stream_fallback_body): check nil for EOF of read method.
patch by Eric Wong. [ruby-core:39134] [Bug #5237] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@33515 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb
index e3bbd245ed..c2eecb7397 100644
--- a/test/ruby/test_io.rb
+++ b/test/ruby/test_io.rb
@@ -826,6 +826,28 @@ class TestIO < Test::Unit::TestCase
}
end
+ class Bug5237
+ attr_reader :count
+ def initialize
+ @count = 0
+ end
+
+ def read(bytes, buffer)
+ @count += 1
+ buffer.replace "this is a test"
+ nil
+ end
+ end
+
+ def test_copy_stream_broken_src_read_eof
+ src = Bug5237.new
+ dst = StringIO.new
+ assert_equal 0, src.count
+ th = Thread.new { IO.copy_stream(src, dst) }
+ flunk("timeout") unless th.join(10)
+ assert_equal 1, src.count
+ end
+
def test_copy_stream_dst_rbuf
mkcdtmpdir {
pipe(proc do |w|