From a1b4816759418ca8fe510e8739622fc5d77ab0f0 Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Sat, 27 Apr 2019 18:53:23 +0200 Subject: Update to ruby/spec@15c9619 --- spec/ruby/optional/capi/io_spec.rb | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'spec/ruby/optional/capi/io_spec.rb') diff --git a/spec/ruby/optional/capi/io_spec.rb b/spec/ruby/optional/capi/io_spec.rb index a832c6a93b..82dc1fc0df 100644 --- a/spec/ruby/optional/capi/io_spec.rb +++ b/spec/ruby/optional/capi/io_spec.rb @@ -299,6 +299,26 @@ describe "C-API IO function" do end end + describe "rb_wait_for_single_fd" do + it "waits til an fd is ready for reading" do + start = false + thr = Thread.new do + start = true + sleep 0.05 + @w_io.write "rb_io_wait_readable" + end + + Thread.pass until start + + @o.rb_wait_for_single_fd(@r_io, 1, nil, nil).should == 1 + + thr.join + end + + it "polls whether an fd is ready for reading if timeout is 0" do + @o.rb_wait_for_single_fd(@r_io, 1, 0, 0).should == 0 + end + end end describe "rb_fd_fix_cloexec" do -- cgit v1.2.3