ruby-changes:37162
From: nobu <ko1@a...>
Date: Wed, 14 Jan 2015 08:37:09 +0900 (JST)
Subject: [ruby-changes:37162] nobu:r49243 (trunk): test_basicsocket.rb: do not hardcode port number
nobu 2015-01-14 08:37:05 +0900 (Wed, 14 Jan 2015) New Revision: 49243 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=49243 Log: test_basicsocket.rb: do not hardcode port number * test/socket/test_basicsocket.rb (socks): use dynamically chosen port number, and remove never used argument. Modified files: trunk/test/socket/test_basicsocket.rb Index: test/socket/test_basicsocket.rb =================================================================== --- test/socket/test_basicsocket.rb (revision 49242) +++ test/socket/test_basicsocket.rb (revision 49243) @@ -86,11 +86,11 @@ class TestSocket_BasicSocket < Test::Uni https://github.com/ruby/ruby/blob/trunk/test/socket/test_basicsocket.rb#L86 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::Uni https://github.com/ruby/ruby/blob/trunk/test/socket/test_basicsocket.rb#L100 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::Uni https://github.com/ruby/ruby/blob/trunk/test/socket/test_basicsocket.rb#L116 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 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/