diff options
| author | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-22 12:40:45 +0000 |
|---|---|---|
| committer | ser <ser@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-09-22 12:40:45 +0000 |
| commit | 8b53e39a2e6110cf13827c88673a3ef2667991cf (patch) | |
| tree | eb1fa37c2a675b75c295285b5c313ba05801c2b8 /test/ruby/test_io.rb | |
| parent | f36a3f0ea57aa05a72cb58937c7a737455a98a38 (diff) | |
| download | ruby-rexml_adds_tests.tar.gz | |
Second merge from trunk.rexml_adds_tests
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/rexml_adds_tests@19455 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_io.rb')
| -rw-r--r-- | test/ruby/test_io.rb | 30 |
1 files changed, 10 insertions, 20 deletions
diff --git a/test/ruby/test_io.rb b/test/ruby/test_io.rb index 35f575aa13..4d9bb51fe3 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 @@ -636,14 +624,16 @@ class TestIO < Test::Unit::TestCase assert_equal("", f2.read) end - proc do - 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 + 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 end |
