mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
spec/ruby/library/socket/addrinfo: skip the specs that uses SOCK_SEQPACKET on Android
SOCK_SEQPACKET seems not to be supported on Android
This commit is contained in:
parent
89bfad17d5
commit
db8c8c0916
1 changed files with 30 additions and 26 deletions
|
@ -274,15 +274,17 @@ describe "Addrinfo#initialize" do
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
with_feature :sock_packet do
|
platform_is_not :android do
|
||||||
[:SOCK_SEQPACKET].each do |type|
|
with_feature :sock_packet do
|
||||||
it "overwrites the socket type #{type}" do
|
[:SOCK_SEQPACKET].each do |type|
|
||||||
sockaddr = ['AF_INET', 80, 'hostname', '127.0.0.1']
|
it "overwrites the socket type #{type}" do
|
||||||
|
sockaddr = ['AF_INET', 80, 'hostname', '127.0.0.1']
|
||||||
|
|
||||||
value = Socket.const_get(type)
|
value = Socket.const_get(type)
|
||||||
addr = Addrinfo.new(sockaddr, nil, value)
|
addr = Addrinfo.new(sockaddr, nil, value)
|
||||||
|
|
||||||
addr.socktype.should == value
|
addr.socktype.should == value
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -448,28 +450,30 @@ describe "Addrinfo#initialize" do
|
||||||
end
|
end
|
||||||
|
|
||||||
platform_is :linux do
|
platform_is :linux do
|
||||||
describe 'and the socket type is set to SOCK_SEQPACKET' do
|
platform_is_not :android do
|
||||||
before do
|
describe 'and the socket type is set to SOCK_SEQPACKET' do
|
||||||
@socktype = Socket::SOCK_SEQPACKET
|
before do
|
||||||
end
|
@socktype = Socket::SOCK_SEQPACKET
|
||||||
|
|
||||||
valid = [:IPPROTO_IP, :IPPROTO_HOPOPTS]
|
|
||||||
|
|
||||||
valid.each do |type|
|
|
||||||
it "overwrites the protocol when using #{type}" do
|
|
||||||
value = Socket.const_get(type)
|
|
||||||
addr = Addrinfo.new(@sockaddr, nil, @socktype, value)
|
|
||||||
|
|
||||||
addr.protocol.should == value
|
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
|
||||||
(Socket.constants.grep(/^IPPROTO/) - valid).each do |type|
|
valid = [:IPPROTO_IP, :IPPROTO_HOPOPTS]
|
||||||
it "raises SocketError when using #{type}" do
|
|
||||||
value = Socket.const_get(type)
|
|
||||||
block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) }
|
|
||||||
|
|
||||||
block.should raise_error(SocketError)
|
valid.each do |type|
|
||||||
|
it "overwrites the protocol when using #{type}" do
|
||||||
|
value = Socket.const_get(type)
|
||||||
|
addr = Addrinfo.new(@sockaddr, nil, @socktype, value)
|
||||||
|
|
||||||
|
addr.protocol.should == value
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
(Socket.constants.grep(/^IPPROTO/) - valid).each do |type|
|
||||||
|
it "raises SocketError when using #{type}" do
|
||||||
|
value = Socket.const_get(type)
|
||||||
|
block = -> { Addrinfo.new(@sockaddr, nil, @socktype, value) }
|
||||||
|
|
||||||
|
block.should raise_error(SocketError)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue