aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog7
-rw-r--r--test/socket/test_addrinfo.rb18
2 files changed, 19 insertions, 6 deletions
diff --git a/ChangeLog b/ChangeLog
index b32115e63f..f636021e37 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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.
diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb
index 851e5a11ea..a8e1dc7f21 100644
--- a/test/socket/test_addrinfo.rb
+++ b/test/socket/test_addrinfo.rb
@@ -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}")
}
}
}