* 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
@ -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>
|
Mon Feb 2 19:17:16 2009 Yukihiro Matsumoto <matz@ruby-lang.org>
|
||||||
|
|
||||||
* doc/NEWS-1.9.1: typo fixed: collect_all -> collect.
|
* 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)
|
assert_equal(ai1.canonname, ai2.canonname)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def ipv6(str)
|
||||||
|
AddrInfo.getaddrinfo(str, nil, :INET6, :DGRAM).fetch(0)
|
||||||
|
end
|
||||||
|
|
||||||
def test_ipv6_address_predicates
|
def test_ipv6_address_predicates
|
||||||
list = [
|
list = [
|
||||||
[:ipv6_unspecified?, "::"],
|
[:ipv6_unspecified?, "::"],
|
||||||
@ -364,24 +368,26 @@ class TestSocketAddrInfo < Test::Unit::TestCase
|
|||||||
]
|
]
|
||||||
list.each {|meth, *addrs|
|
list.each {|meth, *addrs|
|
||||||
addrs.each {|addr|
|
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,|
|
list.each {|meth2,|
|
||||||
next if meth == 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|
|
mlist.each {|meth, *addrs|
|
||||||
addrs.each {|addr|
|
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(AddrInfo.ip(addr).ipv6_multicast?, "AddrInfo.ip(#{addr.inspect}).ipv6_multicast?")
|
assert(ipv6(addr).send(meth), "#{addr_exp}.#{meth}")
|
||||||
|
assert(ipv6(addr).ipv6_multicast?, "#{addr_exp}.ipv6_multicast?")
|
||||||
mlist.each {|meth2,|
|
mlist.each {|meth2,|
|
||||||
next if meth == 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,|
|
list.each {|meth2,|
|
||||||
next if :ipv6_multicast? == 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…
x
Reference in New Issue
Block a user