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
This commit is contained in:
nobu 2015-01-13 23:37:05 +00:00
Родитель d739458b71
Коммит 4d426fc2e0
1 изменённых файлов: 5 добавлений и 5 удалений

Просмотреть файл

@ -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