mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
bb9464dea8
commit
6dea556eb7
3 changed files with 20 additions and 6 deletions
|
@ -1,3 +1,9 @@
|
|||
Wed Dec 1 21:41:57 2010 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/socket/test_addrinfo.rb: extract Errno::EADDRINUSE as a method.
|
||||
|
||||
* test/socket/test_socket.rb: ditto.
|
||||
|
||||
Wed Dec 1 15:08:32 2010 NAKAMURA Usaku <usa@ruby-lang.org>
|
||||
|
||||
* test/openssl/test_ssl.rb (test_not_started_session): non socket
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -105,11 +105,15 @@ class TestSocket < Test::Unit::TestCase
|
|||
49152 + rand(65535-49152+1)
|
||||
end
|
||||
|
||||
def errors_addrinuse
|
||||
[Errno::EADDRINUSE]
|
||||
end
|
||||
|
||||
def test_tcp_server_sockets
|
||||
port = random_port
|
||||
begin
|
||||
sockets = Socket.tcp_server_sockets(port)
|
||||
rescue Errno::EADDRINUSE
|
||||
rescue *errors_addrinuse
|
||||
return # not test failure
|
||||
end
|
||||
begin
|
||||
|
|
Loading…
Add table
Reference in a new issue