diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-07 03:43:19 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2014-07-07 03:43:19 +0000 |
commit | ae8a4a434498d0a65ec1e9428714123203e981c6 (patch) | |
tree | bee6a49192b3ff1f4be2f6ed50d49b8097074d34 /test/ruby | |
parent | 20666f4a4dcba1895cd083c379cd48e98e036631 (diff) |
merge revision(s) 46360,46372: [Backport #8625]
* io.c (io_setstrbuf, io_read): should not shorten the given buffer until
read succeeds. [ruby-core:55951] [Bug #8625]
* io.c (read_all): truncate the buffer before appending read data,
instead of truncating before reading.
[ruby-core:55951] [Bug #8625]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_0_0@46738 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby')
-rw-r--r-- | test/ruby/test_io.rb | 8 | ||||
-rw-r--r-- | test/ruby/test_pipe.rb | 13 |
2 files changed, 21 insertions, 0 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 566564af03..17cfd28bf8 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -1105,6 +1105,14 @@ class TestIO < Test::Unit::TestCase t.value assert_equal("", s) end + with_pipe do |r, w| + s = "xxx" + t = Thread.new {r.read(2, s)} + Thread.pass until t.stop? + t.kill + t.value + assert_equal("xxx", s) + end end def test_write_nonblock diff --git a/test/ruby/test_pipe.rb b/test/ruby/test_pipe.rb index 34f231ad8c..bcea91bebb 100644 --- a/test/ruby/test_pipe.rb +++ b/test/ruby/test_pipe.rb @@ -13,4 +13,17 @@ class TestPipe < Test::Unit::TestCase r.close end end + class WithConversion < self + def open_file(content) + r, w = IO.pipe + w << content + w.close + r.set_encoding("us-ascii:utf-8") + begin + yield r + ensure + r.close + end + end + end end |