From b6f9a60586275bf96ba1d53c8442f3c29501027d Mon Sep 17 00:00:00 2001 From: normal Date: Mon, 14 May 2018 23:51:39 +0000 Subject: [PATCH] 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 --- .../test_wait_for_single_fd.rb | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) diff --git a/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb b/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb index 677c013d4b..777e9d14dd 100644 --- a/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb +++ b/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb @@ -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