summaryrefslogtreecommitdiff
path: root/test/ruby/test_pipe.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-07 03:51:57 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-06-07 03:51:57 +0000
commit0e7cd6417a4d6f4ec7d54ea3114bfd4a71e256ee (patch)
tree70b901645fc56bb797de0dde0e15fac8cef2967a /test/ruby/test_pipe.rb
parent635178762d02f02f8c144629ecb0f15c932a34b3 (diff)
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
Diffstat (limited to 'test/ruby/test_pipe.rb')
-rw-r--r--test/ruby/test_pipe.rb13
1 files changed, 13 insertions, 0 deletions
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