From 240378856b9db2de9bc22537bc22b664d5e0559a Mon Sep 17 00:00:00 2001 From: akr Date: Thu, 11 Dec 2008 10:25:05 +0000 Subject: [PATCH] * test/ruby/test_io.rb (test_dup_many): extracted from test_dup. test in ruby subprocess. at asakusa.rb. [ruby-dev:35648] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20630 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 5 +++++ test/ruby/test_io.rb | 32 +++++++++++++++++++++----------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2a4b3c86e1..1133cf758d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +Thu Dec 11 19:23:09 2008 Tanaka Akira + + * test/ruby/test_io.rb (test_dup_many): extracted from test_dup. + test in ruby subprocess. at asakusa.rb. [ruby-dev:35648] + Thu Dec 11 19:16:30 2008 Tanaka Akira * lib/pathname.rb (Pathname#=~): undefed. at asakusa.rb. diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 34a8d017c0..78cb425ed1 100644 --- a/test/ruby/test_io.rb +++ b/test/ruby/test_io.rb @@ -651,18 +651,28 @@ class TestIO < Test::Unit::TestCase assert_equal("foo\nbar\n", f.read) assert_equal("", f2.read) end + end - a = [] - assert_raise(Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM) do - loop {a << IO.pipe} - end - assert_raise(Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM) do - loop {a << [a[-1][0].dup, a[-1][1].dup]} - end - a.each do |r, w| - r.close unless !r || r.closed? - w.close unless !w || w.closed? - end + def test_dup_many + ruby('-e', <<-'End') {|f| + ok = 0 + a = [] + begin + loop {a << IO.pipe} + rescue Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM + ok += 1 + end + print "no" if ok != 1 + begin + loop {a << [a[-1][0].dup, a[-1][1].dup]} + rescue Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM + ok += 1 + end + print "no" if ok != 2 + print "ok" + End + assert_equal("ok", f.read) + } end def test_inspect