test_wait_for_single_fd.rb: remove with_pipe helper

IO.pipe natively accepts a block, nowadays.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@63422 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
normal 2018-05-14 23:51:39 +00:00
Родитель 863e24b2b1
Коммит b6f9a60586
1 изменённых файлов: 3 добавлений и 13 удалений

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

@ -4,18 +4,8 @@ require 'test/unit'
class TestWaitForSingleFD < Test::Unit::TestCase
require '-test-/wait_for_single_fd'
def with_pipe
r, w = IO.pipe
begin
yield r, w
ensure
r.close unless r.closed?
w.close unless w.closed?
end
end
def test_wait_for_valid_fd
with_pipe do |r,w|
IO.pipe do |r,w|
rc = IO.wait_for_single_fd(w.fileno, RB_WAITFD_OUT, nil)
assert_equal RB_WAITFD_OUT, rc
end
@ -35,7 +25,7 @@ class TestWaitForSingleFD < Test::Unit::TestCase
ver = $1.to_r
skip 'FreeBSD <= 8.2' if ver <= 8.2r
end
with_pipe do |r,w|
IO.pipe do |r,w|
wfd = w.fileno
w.close
assert_raise(Errno::EBADF) do
@ -45,7 +35,7 @@ class TestWaitForSingleFD < Test::Unit::TestCase
end
def test_wait_for_closed_pipe
with_pipe do |r,w|
IO.pipe do |r,w|
w.close
rc = IO.wait_for_single_fd(r.fileno, RB_WAITFD_IN, nil)
assert_equal RB_WAITFD_IN, rc