ruby-changes:7854
From: matz <ko1@a...>
Date: Tue, 16 Sep 2008 08:37:21 +0900 (JST)
Subject: [ruby-changes:7854] Ruby:r19375 (trunk): * test/ruby/test_io.rb (TestIO#test_dup): this test might fail if
matz 2008-09-16 08:37:05 +0900 (Tue, 16 Sep 2008) New Revision: 19375 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=19375 Log: * test/ruby/test_io.rb (TestIO#test_dup): this test might fail if there are any garbage IO objects. Modified files: trunk/ChangeLog trunk/test/ruby/test_io.rb Index: ChangeLog =================================================================== --- ChangeLog (revision 19374) +++ ChangeLog (revision 19375) @@ -1,3 +1,8 @@ +Tue Sep 16 08:35:29 2008 Yukihiro Matsumoto <matz@r...> + + * 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@r...> * string.c (rb_str_buf_cat_ascii): codepoint is unsigned int. Index: test/ruby/test_io.rb =================================================================== --- test/ruby/test_io.rb (revision 19374) +++ test/ruby/test_io.rb (revision 19375) @@ -578,18 +578,6 @@ (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,11 +628,14 @@ 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 def test_inspect -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/