ruby-changes:51215
From: normal <ko1@a...>
Date: Tue, 15 May 2018 08:51:43 +0900 (JST)
Subject: [ruby-changes:51215] normal:r63422 (trunk): test_wait_for_single_fd.rb: remove with_pipe helper
normal 2018-05-15 08:51:39 +0900 (Tue, 15 May 2018) New Revision: 63422 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=63422 Log: test_wait_for_single_fd.rb: remove with_pipe helper IO.pipe natively accepts a block, nowadays. Modified files: trunk/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb Index: test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb =================================================================== --- test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb (revision 63421) +++ test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb (revision 63422) @@ -4,18 +4,8 @@ require 'test/unit' https://github.com/ruby/ruby/blob/trunk/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb#L4 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:: https://github.com/ruby/ruby/blob/trunk/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb#L25 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:: https://github.com/ruby/ruby/blob/trunk/test/-ext-/wait_for_single_fd/test_wait_for_single_fd.rb#L35 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/