mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/socket.c (addrinfo_s_ip): new method AddrInfo.ip.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21579 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
d9395fc466
commit
aaddab6dea
3 changed files with 37 additions and 2 deletions
|
|
@ -7,6 +7,15 @@ require "test/unit"
|
|||
require "tempfile"
|
||||
|
||||
class TestSocketAddrInfo < Test::Unit::TestCase
|
||||
def test_addrinfo_ip
|
||||
ai = AddrInfo.ip("127.0.0.1")
|
||||
assert_equal([0, "127.0.0.1"], Socket.unpack_sockaddr_in(ai))
|
||||
assert_equal(Socket::AF_INET, ai.afamily)
|
||||
assert_equal(Socket::PF_INET, ai.pfamily)
|
||||
assert_equal(0, ai.socktype)
|
||||
assert_equal(0, ai.protocol)
|
||||
end
|
||||
|
||||
def test_addrinfo_tcp
|
||||
ai = AddrInfo.tcp("127.0.0.1", 80)
|
||||
assert_equal([80, "127.0.0.1"], Socket.unpack_sockaddr_in(ai))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue