summaryrefslogtreecommitdiff
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
commit2df1053c1db22aa5693d4982814e79fcb040c5ab (patch)
treed412c399dcda63b10e6ed4f4ad33d0e6d8a94228 /test
parentfe39ce87dda92a3c9a76a70d8465da4b4e172567 (diff)
add a test.
git-svn-id: svn+ssh://ci.ruby-lang.org/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 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))