summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-02 23:30:46 +0000
committerakr <akr@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-02-02 23:30:46 +0000
commitb8fc3e6381fe75bba991a608a21b7eef571e2469 (patch)
treed412c399dcda63b10e6ed4f4ad33d0e6d8a94228 /test
parentf476ccb68a68c552fae1138ab9eec129fb96c93b (diff)
downloadruby-b8fc3e6381fe75bba991a608a21b7eef571e2469.tar.gz
ruby-b8fc3e6381fe75bba991a608a21b7eef571e2469.tar.xz
ruby-b8fc3e6381fe75bba991a608a21b7eef571e2469.zip
add a test.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@21991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test')
-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 a8e1dc7f2..8b2842561 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))