summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--test/socket/test_addrinfo.rb9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb
index a8e1dc7f21..8b2842561f 100644
--- a/test/socket/test_addrinfo.rb
+++ b/test/socket/test_addrinfo.rb
@@ -300,6 +300,15 @@ class TestSocketAddrInfo < Test::Unit::TestCase
s2.close if s2 && !s2.closed?
end
+ def test_family_addrinfo
+ ai = AddrInfo.tcp("0.0.0.0", 4649).family_addrinfo("www.ruby-lang.org", 80)
+ assert_equal(["221.186.184.68", 80], ai.ip_unpack)
+ assert_equal(Socket::SOCK_STREAM, ai.socktype)
+ ai = AddrInfo.unix("/tmp/sock").family_addrinfo("/tmp/sock2")
+ assert_equal("/tmp/sock2", ai.unix_path)
+ assert_equal(Socket::SOCK_STREAM, ai.socktype)
+ end
+
def test_marshal
ai1 = AddrInfo.tcp("127.0.0.1", 80)
ai2 = Marshal.load(Marshal.dump(ai1))