* 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:
akr 2013-06-26 03:09:54 +00:00
Родитель 3ade5353e1
Коммит 3a81008354
2 изменённых файлов: 14 добавлений и 2 удалений

Просмотреть файл

@ -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)