mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05: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
|
@ -151,7 +151,7 @@ class TestDigestExtend < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_block_length
|
||||
assert_raises(RuntimeError) do
|
||||
assert_raise(RuntimeError) do
|
||||
@MyDigest.new.block_length
|
||||
end
|
||||
end
|
||||
|
|
|
@ -97,7 +97,7 @@ class TestIOWait < Test::Unit::TestCase
|
|||
|
||||
def test_wait_writable_closed
|
||||
@w.close
|
||||
assert_raises(IOError) { @w.wait_writable }
|
||||
assert_raise(IOError) { @w.wait_writable }
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -37,7 +37,7 @@ class TestLogDevice < Test::Unit::TestCase
|
|||
logdev = d(STDERR)
|
||||
assert_equal(STDERR, logdev.dev)
|
||||
assert_nil(logdev.filename)
|
||||
assert_raises(TypeError) do
|
||||
assert_raise(TypeError) do
|
||||
d(nil)
|
||||
end
|
||||
#
|
||||
|
|
|
@ -899,7 +899,7 @@ class TestNetHTTPKeepAlive < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
start {|http|
|
||||
assert_raises(EOFError, Errno::ECONNRESET, IOError) {
|
||||
assert_raise(EOFError, Errno::ECONNRESET, IOError) {
|
||||
http.get('/')
|
||||
}
|
||||
}
|
||||
|
|
|
@ -253,7 +253,7 @@ Connection: close
|
|||
hello
|
||||
EOS
|
||||
|
||||
assert_raises Net::HTTPBadResponse do
|
||||
assert_raise Net::HTTPBadResponse do
|
||||
Net::HTTPResponse.read_new(io)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
require 'net/smtp'
|
||||
require 'stringio'
|
||||
require 'minitest/autorun'
|
||||
require 'test/unit'
|
||||
|
||||
module Net
|
||||
class TestSMTP < MiniTest::Unit::TestCase
|
||||
class TestSMTP < Test::Unit::TestCase
|
||||
class FakeSocket
|
||||
def initialize out = "250 OK\n"
|
||||
@write_io = StringIO.new
|
||||
|
@ -24,7 +24,7 @@ module Net
|
|||
def test_critical
|
||||
smtp = Net::SMTP.new 'localhost', 25
|
||||
|
||||
assert_raises RuntimeError do
|
||||
assert_raise RuntimeError do
|
||||
smtp.send :critical do
|
||||
raise 'fail on purpose'
|
||||
end
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require 'net/smtp'
|
||||
require 'minitest/autorun'
|
||||
require 'test/unit'
|
||||
|
||||
module Net
|
||||
class TestSSLSocket < MiniTest::Unit::TestCase
|
||||
class TestSSLSocket < Test::Unit::TestCase
|
||||
class MySMTP < SMTP
|
||||
attr_accessor :fake_tcp, :fake_ssl
|
||||
|
||||
|
@ -52,7 +52,7 @@ module Net
|
|||
connection.fake_tcp = tcp_socket
|
||||
connection.fake_ssl = ssl_socket
|
||||
|
||||
assert_raises(OpenSSL::SSL::SSLError) do
|
||||
assert_raise(OpenSSL::SSL::SSLError) do
|
||||
connection.start
|
||||
end
|
||||
assert_equal true, ssl_socket.closed
|
||||
|
|
|
@ -137,7 +137,7 @@ class TestOpenURI < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_open_timeout
|
||||
assert_raises(Net::OpenTimeout) do
|
||||
assert_raise(Net::OpenTimeout) do
|
||||
URI("http://example.com/").read(open_timeout: 0.000001)
|
||||
end if false # avoid external resources in tests
|
||||
|
||||
|
|
|
@ -552,7 +552,7 @@ rEzBQ0F9dUyqQ9gyRg8KHhDfv9HzT1d/rnUZMkoombwYBRIUChGCYV0GnJcan2Zm
|
|||
end
|
||||
|
||||
def test_primitive_inf_length
|
||||
assert_raises(OpenSSL::ASN1::ASN1Error) do
|
||||
assert_raise(OpenSSL::ASN1::ASN1Error) do
|
||||
spec = %w{ 02 80 02 01 01 00 00 }
|
||||
raw = [spec.join('')].pack('H*')
|
||||
OpenSSL::ASN1.decode(raw)
|
||||
|
|
|
@ -61,7 +61,7 @@ class OpenSSL::TestBuffering < Test::Unit::TestCase
|
|||
raise SystemCallError, 'fail'
|
||||
end
|
||||
|
||||
assert_raises SystemCallError do
|
||||
assert_raise SystemCallError do
|
||||
@io.flush
|
||||
end
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ class OpenSSL::TestDigest < Test::Unit::TestCase
|
|||
def test_openssl_digest
|
||||
assert_equal OpenSSL::Digest::MD5, OpenSSL::Digest("MD5")
|
||||
|
||||
assert_raises NameError do
|
||||
assert_raise NameError do
|
||||
OpenSSL::Digest("no such digest")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -113,7 +113,7 @@ Li8JsX5yIiuVYaBg/6ha3tOg4TCa5K/3r3tVliRZ2Es=
|
|||
end
|
||||
|
||||
def test_create_with_bad_nid
|
||||
assert_raises(ArgumentError) do
|
||||
assert_raise(ArgumentError) do
|
||||
OpenSSL::PKCS12.create(
|
||||
"omg",
|
||||
"hello",
|
||||
|
@ -137,7 +137,7 @@ Li8JsX5yIiuVYaBg/6ha3tOg4TCa5K/3r3tVliRZ2Es=
|
|||
2048
|
||||
)
|
||||
|
||||
assert_raises(TypeError) do
|
||||
assert_raise(TypeError) do
|
||||
OpenSSL::PKCS12.create(
|
||||
"omg",
|
||||
"hello",
|
||||
|
@ -164,7 +164,7 @@ Li8JsX5yIiuVYaBg/6ha3tOg4TCa5K/3r3tVliRZ2Es=
|
|||
2048
|
||||
)
|
||||
|
||||
assert_raises(TypeError) do
|
||||
assert_raise(TypeError) do
|
||||
OpenSSL::PKCS12.create(
|
||||
"omg",
|
||||
"hello",
|
||||
|
|
|
@ -13,7 +13,7 @@ class OpenSSL::TestPKeyDH < Test::Unit::TestCase
|
|||
|
||||
def test_new_break
|
||||
assert_nil(OpenSSL::PKey::DH.new(NEW_KEYLEN) { break })
|
||||
assert_raises(RuntimeError) do
|
||||
assert_raise(RuntimeError) do
|
||||
OpenSSL::PKey::DH.new(NEW_KEYLEN) { raise }
|
||||
end
|
||||
end
|
||||
|
|
|
@ -32,19 +32,19 @@ class TestOptionParser::Acceptable < TestOptionParser
|
|||
assert_equal(%w"", no_error {@opt.parse!(%w"--integer 0x3")})
|
||||
assert_equal(3, @integer)
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--integer 0b")
|
||||
end
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--integer 09")
|
||||
end
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--integer 0x")
|
||||
end
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--integer 1234xyz")
|
||||
end
|
||||
end
|
||||
|
@ -65,11 +65,11 @@ class TestOptionParser::Acceptable < TestOptionParser
|
|||
assert_equal(%w"", no_error {@opt.parse!(%w"--float 1E-2")})
|
||||
assert_in_epsilon(0.01, @float)
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--float 0e")
|
||||
end
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--float 1.234xyz")
|
||||
end
|
||||
end
|
||||
|
@ -87,15 +87,15 @@ class TestOptionParser::Acceptable < TestOptionParser
|
|||
assert_equal(%w"", no_error {@opt.parse!(%w"--numeric 1.2/2.3")})
|
||||
assert_equal(Rational(12, 23), @numeric)
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--numeric 1/")
|
||||
end
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--numeric 12/34xyz")
|
||||
end
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--numeric 12x/34yz")
|
||||
end
|
||||
end
|
||||
|
@ -107,21 +107,21 @@ class TestOptionParser::Acceptable < TestOptionParser
|
|||
assert_equal(%w"", no_error {@opt.parse!(%w"--decimal-integer 10")})
|
||||
assert_equal(10, @decimal_integer)
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--decimal-integer 0b1")
|
||||
end
|
||||
|
||||
e = assert_raises(OptionParser::InvalidArgument) do
|
||||
e = assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--decimal-integer 09")
|
||||
end
|
||||
|
||||
assert_equal("invalid argument: --decimal-integer 09", e.message)
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--decimal-integer x")
|
||||
end
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--decimal-integer 1234xyz")
|
||||
end
|
||||
end
|
||||
|
@ -142,19 +142,19 @@ class TestOptionParser::Acceptable < TestOptionParser
|
|||
assert_equal(%w"", no_error {@opt.parse!(%w"--octal-integer 011")})
|
||||
assert_equal(9, @octal_integer)
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--octal-integer 09")
|
||||
end
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--octal-integer 0b1")
|
||||
end
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--octal-integer x")
|
||||
end
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--octal-integer 01234xyz")
|
||||
end
|
||||
end
|
||||
|
@ -172,21 +172,21 @@ class TestOptionParser::Acceptable < TestOptionParser
|
|||
assert_equal(%w"", no_error {@opt.parse!(%w"--decimal-numeric 1E2")})
|
||||
assert_in_delta(100.0, @decimal_numeric)
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--decimal-numeric 0b1")
|
||||
end
|
||||
|
||||
e = assert_raises(OptionParser::InvalidArgument) do
|
||||
e = assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--decimal-numeric 09")
|
||||
end
|
||||
|
||||
assert_equal("invalid argument: --decimal-numeric 09", e.message)
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--decimal-integer 1234xyz")
|
||||
end
|
||||
|
||||
assert_raises(OptionParser::InvalidArgument) do
|
||||
assert_raise(OptionParser::InvalidArgument) do
|
||||
@opt.parse!(%w"--decimal-integer 12.34xyz")
|
||||
end
|
||||
end
|
||||
|
|
|
@ -21,7 +21,7 @@ module REXMLTests
|
|||
@f.encoding = 'EUC-JP'
|
||||
assert_equal( @u, @f.decode(@e) )
|
||||
# This doesn't happen anymore, for some reason
|
||||
#assert_raises( Iconv::IllegalSequence, "Decoding unicode should fail" ) {
|
||||
#assert_raise( Iconv::IllegalSequence, "Decoding unicode should fail" ) {
|
||||
# @f.decode(@u) == @u
|
||||
#}
|
||||
end
|
||||
|
@ -36,7 +36,7 @@ module REXMLTests
|
|||
@f.encoding = 'EUC-JP'
|
||||
assert_equal( @u, @f.decode(@e) )
|
||||
# This doesn't happen anymore, for some reason
|
||||
#assert_raises( Iconv::IllegalSequence, "Decoding unicode should fail" ) {
|
||||
#assert_raise( Iconv::IllegalSequence, "Decoding unicode should fail" ) {
|
||||
# @f.decode(@u) == @u
|
||||
#}
|
||||
end
|
||||
|
|
|
@ -118,7 +118,7 @@ module REXMLTests
|
|||
# above 10k explodes
|
||||
entities = '&a;' * 3 # 5k entity * 2 = 15k
|
||||
xmldoc = REXML::Document.new(template.sub(/\$/, entities))
|
||||
assert_raises(RuntimeError) do
|
||||
assert_raise(RuntimeError) do
|
||||
xmldoc.root.text
|
||||
end
|
||||
end
|
||||
|
@ -134,7 +134,7 @@ module REXMLTests
|
|||
|
||||
# above 10k explodes
|
||||
entities = '%a;' * 3 # 5k entity * 2 = 15k
|
||||
assert_raises(REXML::ParseException) do
|
||||
assert_raise(REXML::ParseException) do
|
||||
REXML::Document.new(template.sub(/\$/, entities))
|
||||
end
|
||||
end
|
||||
|
|
|
@ -147,7 +147,7 @@ class TestGc < Test::Unit::TestCase
|
|||
|
||||
assert_not_empty info
|
||||
assert_equal info[:gc_by], GC.latest_gc_info(:gc_by)
|
||||
assert_raises(ArgumentError){ GC.latest_gc_info(:invalid) }
|
||||
assert_raise(ArgumentError){ GC.latest_gc_info(:invalid) }
|
||||
assert_raise_with_message(ArgumentError, /\u{30eb 30d3 30fc}/) {GC.latest_gc_info(:"\u{30eb 30d3 30fc}")}
|
||||
end
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -69,15 +69,15 @@ class TC_IPAddr < Test::Unit::TestCase
|
|||
assert_equal("1:2:3:4:5:6:7:0", IPAddr.new("1:2:3:4:5:6:7::").to_s)
|
||||
assert_equal("0:2:3:4:5:6:7:8", IPAddr.new("::2:3:4:5:6:7:8").to_s)
|
||||
|
||||
assert_raises(IPAddr::InvalidAddressError) { IPAddr.new("192.168.0.256") }
|
||||
assert_raises(IPAddr::InvalidAddressError) { IPAddr.new("192.168.0.011") }
|
||||
assert_raises(IPAddr::InvalidAddressError) { IPAddr.new("fe80::1%fxp0") }
|
||||
assert_raises(IPAddr::InvalidAddressError) { IPAddr.new("[192.168.1.2]/120") }
|
||||
assert_raises(IPAddr::InvalidPrefixError) { IPAddr.new("::1/255.255.255.0") }
|
||||
assert_raises(IPAddr::InvalidPrefixError) { IPAddr.new("::1/129") }
|
||||
assert_raises(IPAddr::InvalidPrefixError) { IPAddr.new("192.168.0.1/33") }
|
||||
assert_raises(IPAddr::AddressFamilyError) { IPAddr.new(1) }
|
||||
assert_raises(IPAddr::AddressFamilyError) { IPAddr.new("::ffff:192.168.1.2/120", Socket::AF_INET) }
|
||||
assert_raise(IPAddr::InvalidAddressError) { IPAddr.new("192.168.0.256") }
|
||||
assert_raise(IPAddr::InvalidAddressError) { IPAddr.new("192.168.0.011") }
|
||||
assert_raise(IPAddr::InvalidAddressError) { IPAddr.new("fe80::1%fxp0") }
|
||||
assert_raise(IPAddr::InvalidAddressError) { IPAddr.new("[192.168.1.2]/120") }
|
||||
assert_raise(IPAddr::InvalidPrefixError) { IPAddr.new("::1/255.255.255.0") }
|
||||
assert_raise(IPAddr::InvalidPrefixError) { IPAddr.new("::1/129") }
|
||||
assert_raise(IPAddr::InvalidPrefixError) { IPAddr.new("192.168.0.1/33") }
|
||||
assert_raise(IPAddr::AddressFamilyError) { IPAddr.new(1) }
|
||||
assert_raise(IPAddr::AddressFamilyError) { IPAddr.new("::ffff:192.168.1.2/120", Socket::AF_INET) }
|
||||
end
|
||||
|
||||
def test_s_new_ntoh
|
||||
|
@ -138,14 +138,14 @@ class TC_IPAddr < Test::Unit::TestCase
|
|||
|
||||
def test_ip6_arpa
|
||||
assert_equal("f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.5.0.5.0.e.f.f.3.ip6.arpa", IPAddr.new("3ffe:505:2::f").ip6_arpa)
|
||||
assert_raises(IPAddr::InvalidAddressError) {
|
||||
assert_raise(IPAddr::InvalidAddressError) {
|
||||
IPAddr.new("192.168.2.1").ip6_arpa
|
||||
}
|
||||
end
|
||||
|
||||
def test_ip6_int
|
||||
assert_equal("f.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.2.0.0.0.5.0.5.0.e.f.f.3.ip6.int", IPAddr.new("3ffe:505:2::f").ip6_int)
|
||||
assert_raises(IPAddr::InvalidAddressError) {
|
||||
assert_raise(IPAddr::InvalidAddressError) {
|
||||
IPAddr.new("192.168.2.1").ip6_int
|
||||
}
|
||||
end
|
||||
|
|
|
@ -64,7 +64,7 @@ class TestPrime < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_new
|
||||
exception = assert_raises(NoMethodError) { Prime.new }
|
||||
exception = assert_raise(NoMethodError) { Prime.new }
|
||||
end
|
||||
|
||||
def test_enumerator_succ
|
||||
|
|
|
@ -26,13 +26,13 @@ class TC_Set < Test::Unit::TestCase
|
|||
Set.new([1,2])
|
||||
Set.new('a'..'c')
|
||||
}
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
Set.new(false)
|
||||
}
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
Set.new(1)
|
||||
}
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
Set.new(1,2)
|
||||
}
|
||||
|
||||
|
@ -157,7 +157,7 @@ class TC_Set < Test::Unit::TestCase
|
|||
set1 = Set[1, set2]
|
||||
set2.add(set1)
|
||||
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
set1.flatten!
|
||||
}
|
||||
|
||||
|
@ -199,15 +199,15 @@ class TC_Set < Test::Unit::TestCase
|
|||
def test_superset?
|
||||
set = Set[1,2,3]
|
||||
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
set.superset?()
|
||||
}
|
||||
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
set.superset?(2)
|
||||
}
|
||||
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
set.superset?([2])
|
||||
}
|
||||
|
||||
|
@ -226,15 +226,15 @@ class TC_Set < Test::Unit::TestCase
|
|||
def test_proper_superset?
|
||||
set = Set[1,2,3]
|
||||
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
set.proper_superset?()
|
||||
}
|
||||
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
set.proper_superset?(2)
|
||||
}
|
||||
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
set.proper_superset?([2])
|
||||
}
|
||||
|
||||
|
@ -253,15 +253,15 @@ class TC_Set < Test::Unit::TestCase
|
|||
def test_subset?
|
||||
set = Set[1,2,3]
|
||||
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
set.subset?()
|
||||
}
|
||||
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
set.subset?(2)
|
||||
}
|
||||
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
set.subset?([2])
|
||||
}
|
||||
|
||||
|
@ -280,15 +280,15 @@ class TC_Set < Test::Unit::TestCase
|
|||
def test_proper_subset?
|
||||
set = Set[1,2,3]
|
||||
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
set.proper_subset?()
|
||||
}
|
||||
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
set.proper_subset?(2)
|
||||
}
|
||||
|
||||
assert_raises(ArgumentError) {
|
||||
assert_raise(ArgumentError) {
|
||||
set.proper_subset?([2])
|
||||
}
|
||||
|
||||
|
@ -316,10 +316,10 @@ class TC_Set < Test::Unit::TestCase
|
|||
assert_send([set, :disjoint?, other])
|
||||
assert_send([other, :disjoint?, set])
|
||||
when Class
|
||||
assert_raises(expected) {
|
||||
assert_raise(expected) {
|
||||
set.intersect?(other)
|
||||
}
|
||||
assert_raises(expected) {
|
||||
assert_raise(expected) {
|
||||
set.disjoint?(other)
|
||||
}
|
||||
else
|
||||
|
@ -585,7 +585,7 @@ class TC_Set < Test::Unit::TestCase
|
|||
set << 4
|
||||
assert_same orig, set.freeze
|
||||
assert_equal true, set.frozen?
|
||||
assert_raises(RuntimeError) {
|
||||
assert_raise(RuntimeError) {
|
||||
set << 5
|
||||
}
|
||||
assert_equal 4, set.size
|
||||
|
|
|
@ -20,19 +20,19 @@ class TestSingleton < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_initialize_raises_exception
|
||||
assert_raises NoMethodError do
|
||||
assert_raise NoMethodError do
|
||||
SingletonTest.new
|
||||
end
|
||||
end
|
||||
|
||||
def test_allocate_raises_exception
|
||||
assert_raises NoMethodError do
|
||||
assert_raise NoMethodError do
|
||||
SingletonTest.allocate
|
||||
end
|
||||
end
|
||||
|
||||
def test_clone_raises_exception
|
||||
exception = assert_raises TypeError do
|
||||
exception = assert_raise TypeError do
|
||||
SingletonTest.instance.clone
|
||||
end
|
||||
|
||||
|
@ -42,7 +42,7 @@ class TestSingleton < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_dup_raises_exception
|
||||
exception = assert_raises TypeError do
|
||||
exception = assert_raise TypeError do
|
||||
SingletonTest.instance.dup
|
||||
end
|
||||
|
||||
|
@ -54,7 +54,7 @@ class TestSingleton < Test::Unit::TestCase
|
|||
def test_include_in_module_raises_exception
|
||||
mod = Module.new
|
||||
|
||||
exception = assert_raises TypeError do
|
||||
exception = assert_raise TypeError do
|
||||
mod.class_eval do
|
||||
include Singleton
|
||||
end
|
||||
|
@ -66,7 +66,7 @@ class TestSingleton < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_extending_singleton_raises_exception
|
||||
assert_raises NoMethodError do
|
||||
assert_raise NoMethodError do
|
||||
'foo'.extend Singleton
|
||||
end
|
||||
end
|
||||
|
|
|
@ -11,7 +11,7 @@ end
|
|||
|
||||
class TestSyslog < Test::Unit::TestCase
|
||||
def test_new
|
||||
assert_raises(NoMethodError) {
|
||||
assert_raise(NoMethodError) {
|
||||
Syslog.new
|
||||
}
|
||||
end
|
||||
|
@ -37,7 +37,7 @@ class TestSyslog < Test::Unit::TestCase
|
|||
assert_equal(Syslog::LOG_USER, Syslog.facility)
|
||||
|
||||
# open without close
|
||||
assert_raises(RuntimeError) {
|
||||
assert_raise(RuntimeError) {
|
||||
Syslog.open
|
||||
}
|
||||
|
||||
|
@ -88,7 +88,7 @@ class TestSyslog < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_close
|
||||
assert_raises(RuntimeError) {
|
||||
assert_raise(RuntimeError) {
|
||||
Syslog.close
|
||||
}
|
||||
end
|
||||
|
|
|
@ -29,7 +29,7 @@ class TestWEBrickServer < Test::Unit::TestCase
|
|||
log = []
|
||||
logger = WEBrick::Log.new(log, WEBrick::BasicLog::WARN)
|
||||
|
||||
assert_raises(SignalException) do
|
||||
assert_raise(SignalException) do
|
||||
listener = Object.new
|
||||
def listener.to_io # IO.select invokes #to_io.
|
||||
raise SignalException, 'SIGTERM' # simulate signal in main thread
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require 'minitest/autorun'
|
||||
require 'test/unit'
|
||||
require 'xmlrpc/client'
|
||||
require 'net/http'
|
||||
begin
|
||||
|
@ -7,7 +7,7 @@ rescue LoadError
|
|||
end
|
||||
|
||||
module XMLRPC
|
||||
class ClientTest < MiniTest::Unit::TestCase
|
||||
class ClientTest < Test::Unit::TestCase
|
||||
module Fake
|
||||
class HTTP
|
||||
attr_accessor :read_timeout, :open_timeout, :use_ssl
|
||||
|
@ -182,13 +182,13 @@ module XMLRPC
|
|||
end
|
||||
|
||||
def test_new2_bad_protocol
|
||||
assert_raises(ArgumentError) do
|
||||
assert_raise(ArgumentError) do
|
||||
XMLRPC::Client.new2 'ftp://example.org'
|
||||
end
|
||||
end
|
||||
|
||||
def test_new2_bad_uri
|
||||
assert_raises(ArgumentError) do
|
||||
assert_raise(ArgumentError) do
|
||||
XMLRPC::Client.new2 ':::::'
|
||||
end
|
||||
end
|
||||
|
|
|
@ -233,7 +233,7 @@ if defined? Zlib
|
|||
|
||||
class TestZlibInflate < Test::Unit::TestCase
|
||||
def test_class_inflate_dictionary
|
||||
assert_raises(Zlib::NeedDict) do
|
||||
assert_raise(Zlib::NeedDict) do
|
||||
Zlib::Inflate.inflate([0x08,0x3C,0x0,0x0,0x0,0x0].pack("c*"))
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue