1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

add a test.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21991 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2009-02-02 23:30:46 +00:00
parent fe39ce87dd
commit 2df1053c1d

View file

@ -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))