From 0e7cd6417a4d6f4ec7d54ea3114bfd4a71e256ee Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 7 Jun 2014 03:51:57 +0000 Subject: io.c: truncate before appending * 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/trunk@46372 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_pipe.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test/ruby') 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 -- cgit v1.2.3