From 542f76c6cd2990737df2ef9926411e8f6d0d40e5 Mon Sep 17 00:00:00 2001 From: matz Date: Mon, 15 Sep 2008 23:37:05 +0000 Subject: * test/ruby/test_io.rb (TestIO#test_dup): this test might fail if there are any garbage IO objects. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19375 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/ruby/test_io.rb | 23 +++++++---------------- 1 file changed, 7 insertions(+), 16 deletions(-) (limited to 'test/ruby/test_io.rb') diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 35f575aa13..a82cac239b 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -578,18 +578,6 @@ class TestIO < Test::Unit::TestCase (wt.kill; wt.join) if wt end - def pipe2(&b) - a = [] - a << IO.pipe while true - rescue Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM - yield(*a.last) - ensure - a.each do |r, w| - r.close unless !r || r.closed? - w.close unless !w || w.closed? - end - end - def ruby(*args) args = ['-e', '$>.write($<.read)'] if args.empty? ruby = EnvUtil.rubybin @@ -640,10 +628,13 @@ class TestIO < Test::Unit::TestCase open(__FILE__) # see Bug #493 [ruby-dev:35957] end.call - pipe2 do |r, w| - assert_raise(Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM) do - r2, w2 = r.dup, w.dup - end + a = [] + assert_raise(Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM) do + loop {a << IO.pipe} + end + a.each do |r, w| + r.close unless !r || r.closed? + w.close unless !w || w.closed? end end -- cgit v1.2.3