diff options
author | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-04 13:38:24 +0000 |
---|---|---|
committer | akr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-02-04 13:38:24 +0000 |
commit | 9845b50c1103a6ce3fdd535ad523df1400ff8da4 (patch) | |
tree | 4384223877912568441c970611d4db657bddb49b /test | |
parent | e193fa79d6a34e8afc74ce8be256d7dea743c0aa (diff) | |
download | ruby-9845b50c1103a6ce3fdd535ad523df1400ff8da4.tar.gz |
relax tests for IPv4 compat/mapped IPv6 addresss.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22040 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-rw-r--r-- | test/socket/test_addrinfo.rb | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb index 3271472fc1..55e8183448 100644 --- a/test/socket/test_addrinfo.rb +++ b/test/socket/test_addrinfo.rb @@ -480,7 +480,15 @@ class TestSocketAddrInfo < Test::Unit::TestCase list.each {|meth, *addrs| addrs.each {|addr| addr_exp = "AddrInfo.getaddrinfo(#{addr.inspect}, nil, :INET6, :DGRAM).fetch(0)" - assert(ipv6(addr).send(meth), "#{addr_exp}.#{meth}") + if meth == :ipv6_v4compat? || meth == :ipv6_v4mapped? + # MacOS X returns IPv4 address for ::ffff:1.2.3.4 and ::1.2.3.4. + # Solaris returns IPv4 address for ::ffff:1.2.3.4. + ai = ipv6(addr) + assert(ai.ipv4? || ai.send(meth), "ai=#{addr_exp}; ai.ipv4? || .#{meth}") + else + assert(ipv6(addr).send(meth), "#{addr_exp}.#{meth}") + assert_equal(addr, ipv6(addr).ip_address) + end list.each {|meth2,| next if meth == meth2 assert(!ipv6(addr).send(meth2), "!#{addr_exp}.#{meth2}") |