Skip to content

Commit

Permalink
Fix specs for situations where getaddrinfo returns '' and not '0.0.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
dbussink committed Jul 15, 2012
1 parent bc785da commit 4dd6c79
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
7 changes: 5 additions & 2 deletions spec/ruby/library/socket/socket/getaddrinfo_spec.rb
Expand Up @@ -72,8 +72,11 @@
Socket::IPPROTO_TCP,
Socket::AI_PASSIVE)

expected = [["AF_INET", 80, "0.0.0.0", "0.0.0.0", Socket::AF_INET, Socket::SOCK_STREAM, Socket::IPPROTO_TCP]]
res.should == expected
expected = [["AF_INET", 80, "0.0.0.0", "0.0.0.0", Socket::AF_INET, Socket::SOCK_STREAM, Socket::IPPROTO_TCP],
["AF_INET", 80, "", "0.0.0.0", Socket::AF_INET, Socket::SOCK_STREAM, Socket::IPPROTO_TCP]]
res.each do |a|
expected.should include(a)
end
end

it "accepts empty addresses for IPv4 non-passive sockets" do
Expand Down
6 changes: 4 additions & 2 deletions spec/ruby/library/socket/tcpserver/new_spec.rb
Expand Up @@ -36,7 +36,8 @@
addr = @server.addr
addr[0].should == 'AF_INET'
addr[1].should == SocketSpecs.port
addr[2].should == '0.0.0.0'
expected = ['', '0.0.0.0']
expected.should include(addr[2])
addr[3].should == '0.0.0.0'
end

Expand All @@ -45,7 +46,8 @@
addr = @server.addr
addr[0].should == 'AF_INET'
addr[1].should == SocketSpecs.port
addr[2].should == '0.0.0.0'
expected = ['', '0.0.0.0']
expected.should include(addr[2])
addr[3].should == '0.0.0.0'
end

Expand Down

0 comments on commit 4dd6c79

Please sign in to comment.