From b58fac9a97bc2cb7256b9ae37dfb82a352e6f85e Mon Sep 17 00:00:00 2001 From: nobu Date: Sun, 24 Jan 2016 07:55:05 +0000 Subject: wait readable/writable * ext/io/wait/wait.c (io_wait_readwrite): [EXPERIMENTAL] allow to wait for multiple modes, readable and writable, at once. the arguments may change in the future. [Feature #12013] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@53642 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/io/wait/test_io_wait.rb | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'test') diff --git a/test/io/wait/test_io_wait.rb b/test/io/wait/test_io_wait.rb index a19d2a1ea9..7b9edea587 100644 --- a/test/io/wait/test_io_wait.rb +++ b/test/io/wait/test_io_wait.rb @@ -134,6 +134,18 @@ class TestIOWait < Test::Unit::TestCase assert_raise(IOError) { @w.wait_writable } end + def test_wait_readwrite + assert_equal @r.wait(0, :write), @r.wait(0, :read_write) + end + + def test_wait_readwrite_timeout + assert_equal @w, @w.wait(0.01, :read_write) + written = fill_pipe + assert_nil @w.wait(0.01, :read_write) + @r.read(written) + assert_equal @w, @w.wait(0.01, :read_write) + end + private def fill_pipe -- cgit v1.2.3