diff options
author | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-15 23:37:05 +0000 |
---|---|---|
committer | matz <matz@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-15 23:37:05 +0000 |
commit | 542f76c6cd2990737df2ef9926411e8f6d0d40e5 (patch) | |
tree | db114fd477127469db7aeeaf2349c632541954c2 | |
parent | b0c70a885659bbe373da5bc2b0aa8d5c4f27f03d (diff) | |
download | ruby-542f76c6cd2990737df2ef9926411e8f6d0d40e5.tar.gz |
* 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
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | test/ruby/test_io.rb | 23 |
2 files changed, 12 insertions, 16 deletions
@@ -1,3 +1,8 @@ +Tue Sep 16 08:35:29 2008 Yukihiro Matsumoto <matz@ruby-lang.org> + + * test/ruby/test_io.rb (TestIO#test_dup): this test might fail if + there are any garbage IO objects. + Tue Sep 16 02:02:56 2008 NARUSE, Yui <naruse@ruby-lang.org> * string.c (rb_str_buf_cat_ascii): codepoint is unsigned int. 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 |