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
|
@ -97,4 +97,17 @@ class TestSocket < Test::Unit::TestCase
|
|||
c.close if c
|
||||
IO.for_fd(fd).close if fd
|
||||
end
|
||||
|
||||
def test_initialize
|
||||
Socket.open(Socket::AF_INET, Socket::SOCK_STREAM, 0) {|s|
|
||||
addr = s.getsockname
|
||||
assert_nothing_raised { Socket.unpack_sockaddr_in(addr) }
|
||||
assert_raise(ArgumentError) { Socket.unpack_sockaddr_un(addr) }
|
||||
}
|
||||
Socket.open("AF_INET", "SOCK_STREAM", 0) {|s|
|
||||
addr = s.getsockname
|
||||
assert_nothing_raised { Socket.unpack_sockaddr_in(addr) }
|
||||
assert_raise(ArgumentError) { Socket.unpack_sockaddr_un(addr) }
|
||||
}
|
||||
end
|
||||
end if defined?(Socket)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue