From 2df1053c1db22aa5693d4982814e79fcb040c5ab Mon Sep 17 00:00:00 2001 From: akr Date: Mon, 2 Feb 2009 23:30:46 +0000 Subject: [PATCH] add a test. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/socket/test_addrinfo.rb | 9 +++++++++ 1 file changed, 9 insertions(+) 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))