summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authormatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-15 23:37:05 +0000
committermatz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-09-15 23:37:05 +0000
commit542f76c6cd2990737df2ef9926411e8f6d0d40e5 (patch)
treedb114fd477127469db7aeeaf2349c632541954c2 /test
parentb0c70a885659bbe373da5bc2b0aa8d5c4f27f03d (diff)
* 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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb23
1 files changed, 7 insertions, 16 deletions
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