mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
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:
parent
d739458b71
commit
4d426fc2e0
1 changed files with 5 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue