зеркало из https://github.com/github/ruby.git
* test/socket/test_udp.rb: Close sockets explicitly.
Don't use fixed port number. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
Родитель
3ade5353e1
Коммит
3a81008354
|
@ -1,3 +1,8 @@
|
|||
Wed Jun 26 12:08:51 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* test/socket/test_udp.rb: Close sockets explicitly.
|
||||
Don't use fixed port number.
|
||||
|
||||
Wed Jun 26 07:27:17 2013 Tanaka Akira <akr@fsij.org>
|
||||
|
||||
* bignum.c (bigand_int): Fix a buffer over read.
|
||||
|
|
|
@ -35,14 +35,16 @@ class TestSocket_UDPSocket < Test::Unit::TestCase
|
|||
assert_raise(IOError, "[ruby-dev:25057]") {
|
||||
s.bind(host, 2000)
|
||||
}
|
||||
ensure
|
||||
s.close if s && !s.closed?
|
||||
end
|
||||
|
||||
def test_bind_addrinuse
|
||||
host = "127.0.0.1"
|
||||
port = 2001
|
||||
|
||||
in_use = UDPSocket.new
|
||||
in_use.bind(host, port)
|
||||
in_use.bind(host, 0)
|
||||
port = in_use.addr[1]
|
||||
|
||||
s = UDPSocket.new
|
||||
|
||||
|
@ -51,6 +53,9 @@ class TestSocket_UDPSocket < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
assert_match "bind(2) for \"#{host}\" port #{port}", e.message
|
||||
ensure
|
||||
in_use.close if in_use
|
||||
s.close if s
|
||||
end
|
||||
|
||||
def test_send_too_long
|
||||
|
@ -61,5 +66,7 @@ class TestSocket_UDPSocket < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
assert_match 'for "127.0.0.1" port 7', e.message
|
||||
ensure
|
||||
u.close if u
|
||||
end
|
||||
end if defined?(UDPSocket)
|
||||
|
|
Загрузка…
Ссылка в новой задаче