mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* test/socket/test_addrinfo.rb: use AddrInfo.getaddrinfo to generate
IPv6 address. AddrInfo.ip generates IPv4 address for IPv4 mapped IPv6 address if --with-lookup-order-hack=INET. [ruby-dev:37868] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21968 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
765a6be700
commit
352dcd9ee7
2 changed files with 19 additions and 6 deletions
|
@ -1,3 +1,10 @@
|
|||
Mon Feb 2 19:55:51 2009 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/socket/test_addrinfo.rb: use AddrInfo.getaddrinfo to generate
|
||||
IPv6 address. AddrInfo.ip generates IPv4 address for IPv4 mapped
|
||||
IPv6 address if --with-lookup-order-hack=INET.
|
||||
[ruby-dev:37868]
|
||||
|
||||
Mon Feb 2 19:17:16 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||
|
||||
* doc/NEWS-1.9.1: typo fixed: collect_all -> collect.
|
||||
|
|
|
@ -345,6 +345,10 @@ class TestSocketAddrInfo < Test::Unit::TestCase
|
|||
assert_equal(ai1.canonname, ai2.canonname)
|
||||
end
|
||||
|
||||
def ipv6(str)
|
||||
AddrInfo.getaddrinfo(str, nil, :INET6, :DGRAM).fetch(0)
|
||||
end
|
||||
|
||||
def test_ipv6_address_predicates
|
||||
list = [
|
||||
[:ipv6_unspecified?, "::"],
|
||||
|
@ -364,24 +368,26 @@ class TestSocketAddrInfo < Test::Unit::TestCase
|
|||
]
|
||||
list.each {|meth, *addrs|
|
||||
addrs.each {|addr|
|
||||
assert(AddrInfo.ip(addr).send(meth), "AddrInfo.ip(#{addr.inspect}).#{meth}")
|
||||
addr_exp = "AddrInfo.getaddrinfo(#{addr.inspect}, nil, :INET6, :DGRAM).fetch(0)"
|
||||
assert(ipv6(addr).send(meth), "#{addr_exp}.#{meth}")
|
||||
list.each {|meth2,|
|
||||
next if meth == meth2
|
||||
assert(!AddrInfo.ip(addr).send(meth2), "!AddrInfo.ip(#{addr.inspect}).#{meth2}")
|
||||
assert(!ipv6(addr).send(meth2), "!#{addr_exp}.#{meth2}")
|
||||
}
|
||||
}
|
||||
}
|
||||
mlist.each {|meth, *addrs|
|
||||
addrs.each {|addr|
|
||||
assert(AddrInfo.ip(addr).send(meth), "AddrInfo.ip(#{addr.inspect}).#{meth}")
|
||||
assert(AddrInfo.ip(addr).ipv6_multicast?, "AddrInfo.ip(#{addr.inspect}).ipv6_multicast?")
|
||||
addr_exp = "AddrInfo.getaddrinfo(#{addr.inspect}, nil, :INET6, :DGRAM).fetch(0)"
|
||||
assert(ipv6(addr).send(meth), "#{addr_exp}.#{meth}")
|
||||
assert(ipv6(addr).ipv6_multicast?, "#{addr_exp}.ipv6_multicast?")
|
||||
mlist.each {|meth2,|
|
||||
next if meth == meth2
|
||||
assert(!AddrInfo.ip(addr).send(meth2), "!AddrInfo.ip(#{addr.inspect}).#{meth2}")
|
||||
assert(!ipv6(addr).send(meth2), "!#{addr_exp}.#{meth2}")
|
||||
}
|
||||
list.each {|meth2,|
|
||||
next if :ipv6_multicast? == meth2
|
||||
assert(!AddrInfo.ip(addr).send(meth2), "!AddrInfo.ip(#{addr.inspect}).#{meth2}")
|
||||
assert(!ipv6(addr).send(meth2), "!#{addr_exp}.#{meth2}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue