From 03149710e8fe06daef196b1ea890608ca40eb02c Mon Sep 17 00:00:00 2001 From: akr Date: Sun, 8 Feb 2009 04:53:17 +0000 Subject: * ext/socket/raddrinfo.c (init_unix_addrinfo): add socktype argument. (addrinfo_initialize): follow init_unix_addrinfo change. (addrinfo_s_unix): add optional argument: socktype git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@22120 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/socket/test_addrinfo.rb | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'test/socket') diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb index 3ef69c5c5f..00ed7f4e18 100644 --- a/test/socket/test_addrinfo.rb +++ b/test/socket/test_addrinfo.rb @@ -563,6 +563,15 @@ class TestSocketAddrinfo < Test::Unit::TestCase assert_equal(0, ai.protocol) end + def test_addrinfo_unix_dgram + ai = Addrinfo.unix("/tmp/sock", :DGRAM) + assert_equal("/tmp/sock", Socket.unpack_sockaddr_un(ai)) + assert_equal(Socket::AF_UNIX, ai.afamily) + assert_equal(Socket::PF_UNIX, ai.pfamily) + assert_equal(Socket::SOCK_DGRAM, ai.socktype) + assert_equal(0, ai.protocol) + end + def test_addrinfo_unix_path ai = Addrinfo.unix("/tmp/sock1") assert_equal("/tmp/sock1", ai.unix_path) -- cgit v1.2.3