* 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
This commit is contained in:
matz 2008-09-15 23:37:05 +00:00
Родитель b0c70a8856
Коммит 542f76c6cd
2 изменённых файлов: 12 добавлений и 16 удалений

Просмотреть файл

@ -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> Tue Sep 16 02:02:56 2008 NARUSE, Yui <naruse@ruby-lang.org>
* string.c (rb_str_buf_cat_ascii): codepoint is unsigned int. * string.c (rb_str_buf_cat_ascii): codepoint is unsigned int.

Просмотреть файл

@ -578,18 +578,6 @@ class TestIO < Test::Unit::TestCase
(wt.kill; wt.join) if wt (wt.kill; wt.join) if wt
end 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) def ruby(*args)
args = ['-e', '$>.write($<.read)'] if args.empty? args = ['-e', '$>.write($<.read)'] if args.empty?
ruby = EnvUtil.rubybin ruby = EnvUtil.rubybin
@ -640,10 +628,13 @@ class TestIO < Test::Unit::TestCase
open(__FILE__) # see Bug #493 [ruby-dev:35957] open(__FILE__) # see Bug #493 [ruby-dev:35957]
end.call end.call
pipe2 do |r, w| a = []
assert_raise(Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM) do assert_raise(Errno::EMFILE, Errno::ENFILE, Errno::ENOMEM) do
r2, w2 = r.dup, w.dup loop {a << IO.pipe}
end end
a.each do |r, w|
r.close unless !r || r.closed?
w.close unless !w || w.closed?
end end
end end