1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
This commit is contained in:
Benoit Daloze 2019-06-27 21:02:36 +02:00
parent c940397116
commit d80e44deec
157 changed files with 581 additions and 543 deletions

View file

@ -35,6 +35,11 @@ describe "Socket::BasicSocket#recv_nonblock" do
}
end
it "returns :wait_readable with exception: false" do
@s1.bind(Socket.pack_sockaddr_in(0, ip_address))
@s1.recv_nonblock(5, exception: false).should == :wait_readable
end
it "receives data after it's ready" do
@s1.bind(Socket.pack_sockaddr_in(0, ip_address))
@s2.send("aaa", 0, @s1.getsockname)

View file

@ -31,6 +31,10 @@ describe 'BasicSocket#recvmsg_nonblock' do
it 'raises an exception extending IO::WaitReadable' do
lambda { @server.recvmsg_nonblock }.should raise_error(IO::WaitReadable)
end
it 'returns :wait_readable with exception: false' do
@server.recvmsg_nonblock(exception: false).should == :wait_readable
end
end
describe 'with data available' do

View file

@ -98,6 +98,15 @@ describe 'BasicSocket#sendmsg_nonblock' do
10.times { @client.sendmsg_nonblock('hello' * 1_000_000) }
}.should raise_error(IO::WaitWritable)
end
it 'returns :wait_writable when the underlying buffer is full with exception: false' do
ret = nil
10.times {
ret = @client.sendmsg_nonblock('hello' * 1_000_000, exception: false)
break unless ret.is_a?(Integer)
}
ret.should == :wait_writable
end
end
end
end