diff options
Diffstat (limited to 'test/socket/test_socket.rb')
-rw-r--r-- | test/socket/test_socket.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/test/socket/test_socket.rb b/test/socket/test_socket.rb index 999976b999..179e83f316 100644 --- a/test/socket/test_socket.rb +++ b/test/socket/test_socket.rb @@ -60,6 +60,15 @@ class TestSocket < Test::Unit::TestCase assert_raise(SocketError) { Socket.getaddrinfo("www.kame.net", 80, "AF_UNIX") } end + def test_getaddrinfo_raises_no_errors_on_port_argument_of_0 # [ruby-core:29427] + assert_nothing_raised('[ruby-core:29427]'){ Socket.getaddrinfo('localhost', 0, Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME) } + assert_nothing_raised('[ruby-core:29427]'){ Socket.getaddrinfo('localhost', '0', Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME) } + assert_nothing_raised('[ruby-core:29427]'){ Socket.getaddrinfo('localhost', '00', Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME) } + assert_raise(SocketError, '[ruby-core:29427]'){ Socket.getaddrinfo(nil, nil, Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME) } + assert_nothing_raised('[ruby-core:29427]'){ TCPServer.open('localhost', 0) {} } + end + + def test_getnameinfo assert_raise(SocketError) { Socket.getnameinfo(["AF_UNIX", 80, "0.0.0.0"]) } end |