summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authoryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-13 01:03:08 +0000
committeryugui <yugui@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-13 01:03:08 +0000
commit3a19241fb9d3e27fe462a32e6e402bcd208829b6 (patch)
tree6c49b239029fcd4126a94d91d838659dec5e5791 /test
parente008721b05660b9e306a28dbe13ce5237b7fcf45 (diff)
merges r20630 from trunk into ruby_1_9_1.
* 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/branches/ruby_1_9_1@20701 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_io.rb32
1 files changed, 21 insertions, 11 deletions
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