Ticket #15528: patch-test_socket.rb

File patch-test_socket.rb, 706 bytes (added by aguynamedryan+macports@…, 16 years ago)

Adds a few test cases which expose some of the breakage caused by 10.5.3's change to getaddrinfo

Line 
1--- test/socket/test_socket.rb.orig     2008-06-05 23:17:00.000000000 -0700
2+++ test/socket/test_socket.rb  2008-06-05 23:17:25.000000000 -0700
3@@ -57,6 +57,14 @@
4       }
5     end
6   end
7+ 
8+  def test_getaddrinfo_raises_no_errors_on_port_argument_of_0
9+    # Added 2008-06-05 to ensure that Mac OS X 10.5.3's changes to getaddrinfo don't cause
10+    # Ruby's Socket-based classes to fail.
11+    # Here are two of the situations I found that were causing erroneous errors
12+    assert_nothing_raised(){Socket.getaddrinfo(Socket.gethostname, 0, Socket::AF_INET, Socket::SOCK_STREAM, nil, Socket::AI_CANONNAME)}
13+    assert_nothing_raised(){TCPServer.open('localhost', 0)}
14+  end
15 
16   def test_listen
17     s = nil