summaryrefslogtreecommitdiff
path: root/test/io/wait/test_io_wait.rb
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-24 07:55:05 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-01-24 07:55:05 +0000
commitb58fac9a97bc2cb7256b9ae37dfb82a352e6f85e (patch)
treec5bbc6f01381965bd8a21085b56773345b7779bb /test/io/wait/test_io_wait.rb
parent57752a2503525676e3d21f998cb8bb8357a02242 (diff)
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
Diffstat (limited to 'test/io/wait/test_io_wait.rb')
-rw-r--r--test/io/wait/test_io_wait.rb12
1 files changed, 12 insertions, 0 deletions
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