Skip specs which make non-socket fd nonblocking on Windows
because Windows does not support nonblocking mode except sockets. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@58683 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
683b89070e
commit
1f136bffe6
@ -251,29 +251,31 @@ describe "C-API IO function" do
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "rb_io_wait_readable" do
|
platform_is_not :windows do
|
||||||
it "returns false if there is no error condition" do
|
describe "rb_io_wait_readable" do
|
||||||
@o.rb_io_wait_readable(@r_io, false).should be_false
|
it "returns false if there is no error condition" do
|
||||||
end
|
@o.rb_io_wait_readable(@r_io, false).should be_false
|
||||||
|
|
||||||
it "raises and IOError if passed a closed stream" do
|
|
||||||
@r_io.close
|
|
||||||
lambda { @o.rb_io_wait_readable(@r_io, false) }.should raise_error(IOError)
|
|
||||||
end
|
|
||||||
|
|
||||||
it "blocks until the io is readable and returns true" do
|
|
||||||
@o.instance_variable_set :@write_data, false
|
|
||||||
thr = Thread.new do
|
|
||||||
sleep 0.1 until @o.instance_variable_get(:@write_data)
|
|
||||||
@w_io.write "rb_io_wait_readable"
|
|
||||||
end
|
end
|
||||||
|
|
||||||
Thread.pass until thr.alive?
|
it "raises and IOError if passed a closed stream" do
|
||||||
|
@r_io.close
|
||||||
|
lambda { @o.rb_io_wait_readable(@r_io, false) }.should raise_error(IOError)
|
||||||
|
end
|
||||||
|
|
||||||
@o.rb_io_wait_readable(@r_io, true).should be_true
|
it "blocks until the io is readable and returns true" do
|
||||||
@o.instance_variable_get(:@read_data).should == "rb_io_wait_re"
|
@o.instance_variable_set :@write_data, false
|
||||||
|
thr = Thread.new do
|
||||||
|
sleep 0.1 until @o.instance_variable_get(:@write_data)
|
||||||
|
@w_io.write "rb_io_wait_readable"
|
||||||
|
end
|
||||||
|
|
||||||
thr.join
|
Thread.pass until thr.alive?
|
||||||
|
|
||||||
|
@o.rb_io_wait_readable(@r_io, true).should be_true
|
||||||
|
@o.instance_variable_get(:@read_data).should == "rb_io_wait_re"
|
||||||
|
|
||||||
|
thr.join
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user