From 4d426fc2e03078d583d5d573d4863415c3e3eb8d Mon Sep 17 00:00:00 2001 From: nobu Date: Tue, 13 Jan 2015 23:37:05 +0000 Subject: test_basicsocket.rb: do not hardcode port number * test/socket/test_basicsocket.rb (socks): use dynamically chosen port number, and remove never used argument. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@49243 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/socket/test_basicsocket.rb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/test/socket/test_basicsocket.rb b/test/socket/test_basicsocket.rb index 5c8cffe451..c37f312984 100644 --- a/test/socket/test_basicsocket.rb +++ b/test/socket/test_basicsocket.rb @@ -86,11 +86,11 @@ class TestSocket_BasicSocket < Test::Unit::TestCase end end - def socks(port) - sserv = TCPServer.new(12345) + def socks + sserv = TCPServer.new(0) ssock = nil t = Thread.new { ssock = sserv.accept } - csock = TCPSocket.new('localhost', 12345) + csock = TCPSocket.new('localhost', sserv.addr[1]) t.join yield sserv, ssock, csock ensure @@ -100,7 +100,7 @@ class TestSocket_BasicSocket < Test::Unit::TestCase end def test_close_read - socks(12345) do |sserv, ssock, csock| + socks do |sserv, ssock, csock| # close_read makes subsequent reads raise IOError csock.close_read @@ -116,7 +116,7 @@ class TestSocket_BasicSocket < Test::Unit::TestCase end def test_close_write - socks(12345) do |sserv, ssock, csock| + socks do |sserv, ssock, csock| # close_write makes subsequent writes raise IOError csock.close_write -- cgit v1.2.3