mirror of
https://github.com/ruby/ruby.git
synced 2025-08-23 04:55:21 +02:00
use assert_raise
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@50727 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
21f2c194bb
commit
ae042f21fb
30 changed files with 100 additions and 100 deletions
|
@ -279,7 +279,7 @@ class TestSocketNonblock < Test::Unit::TestCase
|
|||
def test_sendmsg_nonblock_seqpacket
|
||||
buf = '*' * 10000
|
||||
UNIXSocket.pair(:SEQPACKET) do |s1, s2|
|
||||
assert_raises(IO::WaitWritable) do
|
||||
assert_raise(IO::WaitWritable) do
|
||||
loop { s1.sendmsg_nonblock(buf) }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -78,7 +78,7 @@ class TestSocket < Test::Unit::TestCase
|
|||
port, = Socket.unpack_sockaddr_in(addr)
|
||||
|
||||
Socket.open(Socket::AF_INET, Socket::SOCK_STREAM, 0) {|s|
|
||||
e = assert_raises(Errno::EADDRINUSE) do
|
||||
e = assert_raise(Errno::EADDRINUSE) do
|
||||
s.bind(Socket.sockaddr_in(port, "127.0.0.1"))
|
||||
end
|
||||
|
||||
|
@ -556,7 +556,7 @@ class TestSocket < Test::Unit::TestCase
|
|||
# some platforms may not timeout when the listener queue overflows,
|
||||
# but we know Linux does with the default listen backlog of SOMAXCONN for
|
||||
# TCPServer.
|
||||
assert_raises(Errno::ETIMEDOUT) do
|
||||
assert_raise(Errno::ETIMEDOUT) do
|
||||
(Socket::SOMAXCONN*2).times do |i|
|
||||
sock = Socket.tcp(host, port, :connect_timeout => 0)
|
||||
assert_equal sock, IO.select(nil, [ sock ])[1][0],
|
||||
|
|
|
@ -79,9 +79,9 @@ class TestSocket_TCPSocket < Test::Unit::TestCase
|
|||
|
||||
def test_accept_nonblock
|
||||
TCPServer.open("localhost", 0) {|svr|
|
||||
assert_raises(IO::WaitReadable) { svr.accept_nonblock }
|
||||
assert_raise(IO::WaitReadable) { svr.accept_nonblock }
|
||||
assert_equal :wait_readable, svr.accept_nonblock(exception: false)
|
||||
assert_raises(IO::WaitReadable) { svr.accept_nonblock(exception: true) }
|
||||
assert_raise(IO::WaitReadable) { svr.accept_nonblock(exception: true) }
|
||||
}
|
||||
end
|
||||
end if defined?(TCPSocket)
|
||||
|
|
|
@ -48,7 +48,7 @@ class TestSocket_UDPSocket < Test::Unit::TestCase
|
|||
|
||||
s = UDPSocket.new
|
||||
|
||||
e = assert_raises(Errno::EADDRINUSE) do
|
||||
e = assert_raise(Errno::EADDRINUSE) do
|
||||
s.bind(host, port)
|
||||
end
|
||||
|
||||
|
@ -61,7 +61,7 @@ class TestSocket_UDPSocket < Test::Unit::TestCase
|
|||
def test_send_too_long
|
||||
u = UDPSocket.new
|
||||
|
||||
e = assert_raises Errno::EMSGSIZE do
|
||||
e = assert_raise(Errno::EMSGSIZE) do
|
||||
u.send "\0" * 100_000, 0, "127.0.0.1", 7 # echo
|
||||
end
|
||||
|
||||
|
|
|
@ -665,8 +665,8 @@ class TestSocket_UNIXSocket < Test::Unit::TestCase
|
|||
|
||||
def test_accept_nonblock
|
||||
bound_unix_socket(UNIXServer) {|serv, path|
|
||||
assert_raises(IO::WaitReadable) { serv.accept_nonblock }
|
||||
assert_raises(IO::WaitReadable) { serv.accept_nonblock(exception: true) }
|
||||
assert_raise(IO::WaitReadable) { serv.accept_nonblock }
|
||||
assert_raise(IO::WaitReadable) { serv.accept_nonblock(exception: true) }
|
||||
assert_equal :wait_readable, serv.accept_nonblock(exception: false)
|
||||
}
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue