mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* ext/socket/mkconstants.rb: generate family_to_int().
* ext/socket/socket.c (setup_domain_and_type): use family_to_int. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@21240 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
30f3c8c70b
commit
0c838b4947
5 changed files with 69 additions and 47 deletions
|
|
@ -166,4 +166,18 @@ class TestUNIXSocket < Test::Unit::TestCase
|
|||
assert_kind_of(UNIXSocket, pair[1])
|
||||
end
|
||||
|
||||
def test_initialize
|
||||
Socket.open(Socket::AF_UNIX, Socket::SOCK_STREAM, 0) {|s|
|
||||
addr = s.getsockname
|
||||
assert_nothing_raised { Socket.unpack_sockaddr_un(addr) }
|
||||
assert_raise(ArgumentError) { Socket.unpack_sockaddr_in(addr) }
|
||||
}
|
||||
Socket.open("AF_UNIX", "SOCK_STREAM", 0) {|s|
|
||||
addr = s.getsockname
|
||||
assert_nothing_raised { Socket.unpack_sockaddr_un(addr) }
|
||||
assert_raise(ArgumentError) { Socket.unpack_sockaddr_in(addr) }
|
||||
}
|
||||
end
|
||||
|
||||
|
||||
end if defined?(UNIXSocket) && /cygwin/ !~ RUBY_PLATFORM
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue