diff options
author | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-14 23:51:39 +0000 |
---|---|---|
committer | normal <normal@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-05-14 23:51:39 +0000 |
commit | b6f9a60586275bf96ba1d53c8442f3c29501027d (patch) | |
tree | 4765fbcf006b6aa893d06e3e77cdf6d475e56ff5 | |
parent | 863e24b2b1a1b946c89d32575c2814b564a1bf95 (diff) | |
download | ruby-b6f9a60586275bf96ba1d53c8442f3c29501027d.tar.gz |
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
-rw-r--r-- | test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb | 16 |
1 files 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 |