From 6dea556eb7f85f234a0b698aa0dd4b1882c4e8ca Mon Sep 17 00:00:00 2001 From: akr Date: Wed, 1 Dec 2010 12:42:50 +0000 Subject: * test/socket/test_addrinfo.rb: extract Errno::EADDRINUSE as a method. * test/socket/test_socket.rb: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@29996 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/socket/test_addrinfo.rb | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'test/socket/test_addrinfo.rb') diff --git a/test/socket/test_addrinfo.rb b/test/socket/test_addrinfo.rb index 77ef0ae321..cf6aec30df 100644 --- a/test/socket/test_addrinfo.rb +++ b/test/socket/test_addrinfo.rb @@ -330,6 +330,10 @@ class TestSocketAddrinfo < Test::Unit::TestCase 49152 + rand(65535-49152+1) end + def errors_addrinuse + [Errno::EADDRINUSE] + end + def test_connect_from TCPServer.open("0.0.0.0", 0) {|serv| serv_ai = Addrinfo.new(serv.getsockname, :INET, :STREAM) @@ -344,7 +348,7 @@ class TestSocketAddrinfo < Test::Unit::TestCase s2.close end } - rescue Errno::EADDRINUSE + rescue *errors_addrinuse # not test failure end } @@ -365,7 +369,7 @@ class TestSocketAddrinfo < Test::Unit::TestCase s2.close end } - rescue Errno::EADDRINUSE + rescue *errors_addrinuse # not test failure end } @@ -385,7 +389,7 @@ class TestSocketAddrinfo < Test::Unit::TestCase s2.close end } - rescue Errno::EADDRINUSE + rescue *errors_addrinuse # not test failure end } @@ -398,7 +402,7 @@ class TestSocketAddrinfo < Test::Unit::TestCase client_ai.bind {|s| assert_equal(port, s.local_address.ip_port) } - rescue Errno::EADDRINUSE + rescue *errors_addrinuse # not test failure end end @@ -422,7 +426,7 @@ class TestSocketAddrinfo < Test::Unit::TestCase end } } - rescue Errno::EADDRINUSE + rescue *errors_addrinuse # not test failure end end -- cgit v1.2.3