summaryrefslogtreecommitdiff
path: root/test/socket/test_tcp.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/socket/test_tcp.rb')
-rw-r--r--test/socket/test_tcp.rb10
1 files changed, 6 insertions, 4 deletions
diff --git a/test/socket/test_tcp.rb b/test/socket/test_tcp.rb
index 3cf1e3c..b594682 100644
--- a/test/socket/test_tcp.rb
+++ b/test/socket/test_tcp.rb
@@ -7,19 +7,21 @@ end
class TestSocket_TCPSocket < Test::Unit::TestCase
def test_initialize_failure
- s = TCPServer.new("localhost", nil)
+ addr = '127.0.0.1'
+
+ s = TCPServer.new(addr, nil)
server_port = s.addr[1]
- c = TCPSocket.new("localhost", server_port)
+ c = TCPSocket.new(addr, server_port)
client_port = c.addr[1]
begin
# TCPServer.new uses SO_REUSEADDR so we must create a failure on the
# local address.
- TCPSocket.new("localhost", server_port, "localhost", client_port)
+ TCPSocket.new(addr, server_port, addr, client_port)
flunk "expected SystemCallError"
rescue SystemCallError => e
- assert_match "for \"localhost\" port #{client_port}", e.message
+ assert_match "for \"#{addr}\" port #{client_port}", e.message
end
end