1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* test: assert_raises has been deprecated since a long time ago.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@19536 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2008-09-24 17:44:39 +00:00
parent 48fdf59dcf
commit 00b4a3f9c4
59 changed files with 284 additions and 284 deletions

View file

@ -534,7 +534,7 @@ if defined? DBM
v = DBM.open("#{@tmproot}/a", nil, DBM::READER) {|d|
# Errno::EPERM is raised on Solaris which use ndbm.
# DBMError is raised on Debian which use gdbm.
assert_raises(Errno::EPERM, DBMError) { d["k"] = "v" }
assert_raise(Errno::EPERM, DBMError) { d["k"] = "v" }
true
}
assert(v)
@ -555,7 +555,7 @@ if defined? DBM
def test_freeze
DBM.open("#{@tmproot}/a") {|d|
d.freeze
assert_raises(RuntimeError) { d["k"] = "v" }
assert_raise(RuntimeError) { d["k"] = "v" }
}
end
end

View file

@ -127,23 +127,23 @@ module DRbCore
assert_equal('DRbEx', obj.name)
end
assert_raises(DRb::DRbUnknownError) do
assert_raise(DRb::DRbUnknownError) do
@there.unknown_error
end
onecky = FailOnecky.new('3')
assert_raises(FailOnecky::OneckyError) do
assert_raise(FailOnecky::OneckyError) do
@there.sample(onecky, 1, 2)
end
end
def test_03
assert_equal(8, @there.sum(1, 1, 1, 1, 1, 1, 1, 1))
assert_raises(ArgumentError) do
assert_raise(ArgumentError) do
@there.sum(1, 1, 1, 1, 1, 1, 1, 1, 1)
end
assert_raises(DRb::DRbConnError) do
assert_raise(DRb::DRbConnError) do
@there.sum('1' * 4096)
end
end
@ -168,10 +168,10 @@ module DRbCore
def test_06_timeout
ten = Onecky.new(10)
assert_raises(TimeoutError) do
assert_raise(TimeoutError) do
@there.do_timeout(ten)
end
assert_raises(TimeoutError) do
assert_raise(TimeoutError) do
@there.do_timeout(ten)
end
end
@ -208,7 +208,7 @@ module DRbCore
assert_match(/^undefined method \`undefined_method_test\'/, $!.message)
end
}
assert_raises(DRb::DRbConnError) do
assert_raise(DRb::DRbConnError) do
@there.method_missing(:__send__, :to_s)
end
assert_equal(true, @there.missing)
@ -261,7 +261,7 @@ module DRbCore
end
def test_11_remote_no_method_error
assert_raises(DRb::DRbRemoteError) do
assert_raise(DRb::DRbRemoteError) do
@there.remote_no_method_error
end
begin

View file

@ -219,21 +219,21 @@ class TestDRbEval # < Test::Unit::TestCase
end
def test_01_safe1_safe4_eval
assert_raises(SecurityError) do
assert_raise(SecurityError) do
@there.method_missing(:instance_eval, 'ENV.inspect')
end
assert_raises(SecurityError) do
assert_raise(SecurityError) do
@there.method_missing(:send, :eval, 'ENV.inspect')
end
remote_class = @there.remote_class
assert_raises(SecurityError) do
assert_raise(SecurityError) do
remote_class.class_eval('ENV.inspect')
end
assert_raises(SecurityError) do
assert_raise(SecurityError) do
remote_class.module_eval('ENV.inspect')
end
@ -246,11 +246,11 @@ class TestDRbEval # < Test::Unit::TestCase
assert_equal(1, remote_class.module_eval('1'))
assert_raises(SecurityError) do
assert_raise(SecurityError) do
remote_class.class_eval('ENV = {}')
end
assert_raises(SecurityError) do
assert_raise(SecurityError) do
remote_class.module_eval('ENV = {}')
end
end
@ -283,7 +283,7 @@ class TestDRbLarge < Test::Unit::TestCase
end
def test_04_many_arg
assert_raises(ArgumentError) {
assert_raise(ArgumentError) {
@there.arg_test(1, 2, 3, 4, 5, 6, 7, 8, 9, 0)
}
end

View file

@ -192,7 +192,7 @@ end
TARGETS.each do |fname|
assert cmp(fname, fname), 'not same?'
end
assert_raises(ArgumentError) {
assert_raise(ArgumentError) {
cmp TARGETS[0], TARGETS[0], :undefinedoption => true
}
@ -225,21 +225,21 @@ end
# src==dest (1) same path
touch 'tmp/cptmp'
assert_raises(ArgumentError) {
assert_raise(ArgumentError) {
cp 'tmp/cptmp', 'tmp/cptmp'
}
if have_symlink?
# src==dest (2) symlink and its target
File.symlink 'cptmp', 'tmp/cptmp_symlink'
assert_raises(ArgumentError) {
assert_raise(ArgumentError) {
cp 'tmp/cptmp', 'tmp/cptmp_symlink'
}
assert_raises(ArgumentError) {
assert_raise(ArgumentError) {
cp 'tmp/cptmp_symlink', 'tmp/cptmp'
}
# src==dest (3) looped symlink
File.symlink 'symlink', 'tmp/symlink'
assert_raises(Errno::ELOOP) {
assert_raise(Errno::ELOOP) {
cp 'tmp/symlink', 'tmp/symlink'
}
end
@ -328,31 +328,31 @@ end
mkdir 'tmp/tmpdir'
mkdir_p 'tmp/dest2/tmpdir'
assert_raises(Errno::EEXIST) {
assert_raise(Errno::EEXIST) {
mv 'tmp/tmpdir', 'tmp/dest2'
}
mkdir 'tmp/dest2/tmpdir/junk'
assert_raises(Errno::EEXIST, "[ruby-talk:124368]") {
assert_raise(Errno::EEXIST, "[ruby-talk:124368]") {
mv 'tmp/tmpdir', 'tmp/dest2'
}
# src==dest (1) same path
touch 'tmp/cptmp'
assert_raises(ArgumentError) {
assert_raise(ArgumentError) {
mv 'tmp/cptmp', 'tmp/cptmp'
}
if have_symlink?
# src==dest (2) symlink and its target
File.symlink 'cptmp', 'tmp/cptmp_symlink'
assert_raises(ArgumentError) {
assert_raise(ArgumentError) {
mv 'tmp/cptmp', 'tmp/cptmp_symlink'
}
assert_raises(ArgumentError) {
assert_raise(ArgumentError) {
mv 'tmp/cptmp_symlink', 'tmp/cptmp'
}
# src==dest (3) looped symlink
File.symlink 'symlink', 'tmp/symlink'
assert_raises(Errno::ELOOP) {
assert_raise(Errno::ELOOP) {
mv 'tmp/symlink', 'tmp/symlink'
}
end
@ -589,16 +589,16 @@ if have_hardlink?
# src==dest (1) same path
touch 'tmp/cptmp'
assert_raises(Errno::EEXIST) {
assert_raise(Errno::EEXIST) {
ln 'tmp/cptmp', 'tmp/cptmp'
}
if have_symlink?
# src==dest (2) symlink and its target
File.symlink 'cptmp', 'tmp/symlink'
assert_raises(Errno::EEXIST) {
assert_raise(Errno::EEXIST) {
ln 'tmp/cptmp', 'tmp/symlink' # normal file -> symlink
}
assert_raises(Errno::EEXIST) {
assert_raise(Errno::EEXIST) {
ln 'tmp/symlink', 'tmp/cptmp' # symlink -> normal file
}
# src==dest (3) looped symlink
@ -796,21 +796,21 @@ end
# src==dest (1) same path
touch 'tmp/cptmp'
assert_raises(ArgumentError) {
assert_raise(ArgumentError) {
install 'tmp/cptmp', 'tmp/cptmp'
}
if have_symlink?
# src==dest (2) symlink and its target
File.symlink 'cptmp', 'tmp/cptmp_symlink'
assert_raises(ArgumentError) {
assert_raise(ArgumentError) {
install 'tmp/cptmp', 'tmp/cptmp_symlink'
}
assert_raises(ArgumentError) {
assert_raise(ArgumentError) {
install 'tmp/cptmp_symlink', 'tmp/cptmp'
}
# src==dest (3) looped symlink
File.symlink 'symlink', 'tmp/symlink'
assert_raises(Errno::ELOOP) {
assert_raise(Errno::ELOOP) {
# File#install invokes open(2), always ELOOP must be raised
install 'tmp/symlink', 'tmp/symlink'
}

View file

@ -687,7 +687,7 @@ if defined? GDBM
def test_reader_open
GDBM.open("#{@tmproot}/a.dbm") {} # create a db.
v = GDBM.open("#{@tmproot}/a.dbm", nil, GDBM::READER) {|d|
assert_raises(GDBMError) { d["k"] = "v" }
assert_raise(GDBMError) { d["k"] = "v" }
true
}
assert(v)
@ -708,7 +708,7 @@ if defined? GDBM
def test_freeze
GDBM.open("#{@tmproot}/a.dbm") {|d|
d.freeze
assert_raises(RuntimeError) { d["k"] = "v" }
assert_raise(RuntimeError) { d["k"] = "v" }
}
end
end

View file

@ -49,10 +49,10 @@ class TC_JSON < Test::Unit::TestCase
assert_equal([23], parse('[23]'))
assert_equal([0.23], parse('[0.23]'))
assert_equal([0.0], parse('[0e0]'))
assert_raises(JSON::ParserError) { parse('[+23.2]') }
assert_raises(JSON::ParserError) { parse('[+23]') }
assert_raises(JSON::ParserError) { parse('[.23]') }
assert_raises(JSON::ParserError) { parse('[023]') }
assert_raise(JSON::ParserError) { parse('[+23.2]') }
assert_raise(JSON::ParserError) { parse('[+23]') }
assert_raise(JSON::ParserError) { parse('[.23]') }
assert_raise(JSON::ParserError) { parse('[023]') }
assert_equal_float [3.141], parse('[3.141]')
assert_equal_float [-3.141], parse('[-3.141]')
assert_equal_float [3.141], parse('[3141e-3]')
@ -61,11 +61,11 @@ class TC_JSON < Test::Unit::TestCase
assert_equal_float [3.141], parse('[3141.0E-3]')
assert_equal_float [-3.141], parse('[-3141.0e-3]')
assert_equal_float [-3.141], parse('[-3141e-3]')
assert_raises(ParserError) { parse('[NaN]') }
assert_raise(ParserError) { parse('[NaN]') }
assert parse('[NaN]', :allow_nan => true).first.nan?
assert_raises(ParserError) { parse('[Infinity]') }
assert_raise(ParserError) { parse('[Infinity]') }
assert_equal [1.0/0], parse('[Infinity]', :allow_nan => true)
assert_raises(ParserError) { parse('[-Infinity]') }
assert_raise(ParserError) { parse('[-Infinity]') }
assert_equal [-1.0/0], parse('[-Infinity]', :allow_nan => true)
assert_equal([""], parse('[""]'))
assert_equal(["foobar"], parse('["foobar"]'))
@ -79,7 +79,7 @@ class TC_JSON < Test::Unit::TestCase
assert_equal({ "a" => nil }, parse('{"a":null}'))
assert_equal({ "a" => false }, parse('{ "a" : false } '))
assert_equal({ "a" => false }, parse('{"a":false}'))
assert_raises(JSON::ParserError) { parse('{false}') }
assert_raise(JSON::ParserError) { parse('{false}') }
assert_equal({ "a" => true }, parse('{"a":true}'))
assert_equal({ "a" => true }, parse(' { "a" : true } '))
assert_equal({ "a" => -23 }, parse(' { "a" : -23 } '))
@ -181,7 +181,7 @@ EOT
* comment */
}
EOT
assert_raises(ParserError) { parse(json) }
assert_raise(ParserError) { parse(json) }
json = <<EOT
{
"key1":"value1" /* multi line
@ -190,7 +190,7 @@ EOT
and again, throw an Error */
}
EOT
assert_raises(ParserError) { parse(json) }
assert_raise(ParserError) { parse(json) }
json = <<EOT
{
"key1":"value1" /*/*/
@ -226,32 +226,32 @@ EOT
end
def test_wrong_inputs
assert_raises(ParserError) { JSON.parse('"foo"') }
assert_raises(ParserError) { JSON.parse('123') }
assert_raises(ParserError) { JSON.parse('[] bla') }
assert_raises(ParserError) { JSON.parse('[] 1') }
assert_raises(ParserError) { JSON.parse('[] []') }
assert_raises(ParserError) { JSON.parse('[] {}') }
assert_raises(ParserError) { JSON.parse('{} []') }
assert_raises(ParserError) { JSON.parse('{} {}') }
assert_raises(ParserError) { JSON.parse('[NULL]') }
assert_raises(ParserError) { JSON.parse('[FALSE]') }
assert_raises(ParserError) { JSON.parse('[TRUE]') }
assert_raises(ParserError) { JSON.parse('[07] ') }
assert_raises(ParserError) { JSON.parse('[0a]') }
assert_raises(ParserError) { JSON.parse('[1.]') }
assert_raises(ParserError) { JSON.parse(' ') }
assert_raise(ParserError) { JSON.parse('"foo"') }
assert_raise(ParserError) { JSON.parse('123') }
assert_raise(ParserError) { JSON.parse('[] bla') }
assert_raise(ParserError) { JSON.parse('[] 1') }
assert_raise(ParserError) { JSON.parse('[] []') }
assert_raise(ParserError) { JSON.parse('[] {}') }
assert_raise(ParserError) { JSON.parse('{} []') }
assert_raise(ParserError) { JSON.parse('{} {}') }
assert_raise(ParserError) { JSON.parse('[NULL]') }
assert_raise(ParserError) { JSON.parse('[FALSE]') }
assert_raise(ParserError) { JSON.parse('[TRUE]') }
assert_raise(ParserError) { JSON.parse('[07] ') }
assert_raise(ParserError) { JSON.parse('[0a]') }
assert_raise(ParserError) { JSON.parse('[1.]') }
assert_raise(ParserError) { JSON.parse(' ') }
end
def test_nesting
assert_raises(JSON::NestingError) { JSON.parse '[[]]', :max_nesting => 1 }
assert_raises(JSON::NestingError) { JSON.parser.new('[[]]', :max_nesting => 1).parse }
assert_raise(JSON::NestingError) { JSON.parse '[[]]', :max_nesting => 1 }
assert_raise(JSON::NestingError) { JSON.parser.new('[[]]', :max_nesting => 1).parse }
assert_equal [[]], JSON.parse('[[]]', :max_nesting => 2)
too_deep = '[[[[[[[[[[[[[[[[[[[["Too deep"]]]]]]]]]]]]]]]]]]]]'
too_deep_ary = eval too_deep
assert_raises(JSON::NestingError) { JSON.parse too_deep }
assert_raises(JSON::NestingError) { JSON.parser.new(too_deep).parse }
assert_raises(JSON::NestingError) { JSON.parse too_deep, :max_nesting => 19 }
assert_raise(JSON::NestingError) { JSON.parse too_deep }
assert_raise(JSON::NestingError) { JSON.parser.new(too_deep).parse }
assert_raise(JSON::NestingError) { JSON.parse too_deep, :max_nesting => 19 }
ok = JSON.parse too_deep, :max_nesting => 20
assert_equal too_deep_ary, ok
ok = JSON.parse too_deep, :max_nesting => nil
@ -260,10 +260,10 @@ EOT
assert_equal too_deep_ary, ok
ok = JSON.parse too_deep, :max_nesting => 0
assert_equal too_deep_ary, ok
assert_raises(JSON::NestingError) { JSON.generate [[]], :max_nesting => 1 }
assert_raise(JSON::NestingError) { JSON.generate [[]], :max_nesting => 1 }
assert_equal '[[]]', JSON.generate([[]], :max_nesting => 2)
assert_raises(JSON::NestingError) { JSON.generate too_deep_ary }
assert_raises(JSON::NestingError) { JSON.generate too_deep_ary, :max_nesting => 19 }
assert_raise(JSON::NestingError) { JSON.generate too_deep_ary }
assert_raise(JSON::NestingError) { JSON.generate too_deep_ary, :max_nesting => 19 }
ok = JSON.generate too_deep_ary, :max_nesting => 20
assert_equal too_deep, ok
ok = JSON.generate too_deep_ary, :max_nesting => nil
@ -278,8 +278,8 @@ EOT
too_deep = '[[[[[[[[[[[[[[[[[[[[]]]]]]]]]]]]]]]]]]]]'
assert_equal too_deep, JSON.dump(eval(too_deep))
assert_kind_of String, Marshal.dump(eval(too_deep))
assert_raises(ArgumentError) { JSON.dump(eval(too_deep), 19) }
assert_raises(ArgumentError) { Marshal.dump(eval(too_deep), 19) }
assert_raise(ArgumentError) { JSON.dump(eval(too_deep), 19) }
assert_raise(ArgumentError) { Marshal.dump(eval(too_deep), 19) }
assert_equal too_deep, JSON.dump(eval(too_deep), 20)
assert_kind_of String, Marshal.dump(eval(too_deep), 20)
output = StringIO.new

View file

@ -89,7 +89,7 @@ class TC_JSONAddition < Test::Unit::TestCase
c = C.new
assert !C.json_creatable?
json = generate(c)
assert_raises(ArgumentError) { JSON.parse(json) }
assert_raise(ArgumentError) { JSON.parse(json) }
end
def test_raw_strings
@ -129,7 +129,7 @@ EOT
assert_equal s, JSON(JSON(s))
struct = Struct.new :foo, :bar
s = struct.new 4711, 'foot'
assert_raises(JSONError) { JSON(s) }
assert_raise(JSONError) { JSON(s) }
begin
raise TypeError, "test me"
rescue TypeError => e

View file

@ -20,7 +20,7 @@ class TC_JSONFixtures < Test::Unit::TestCase
def test_failing
for name, source in @failed
assert_raises(JSON::ParserError, JSON::NestingError,
assert_raise(JSON::ParserError, JSON::NestingError,
"Did not fail for fixture '#{name}'") do
JSON.parse(source)
end

View file

@ -70,30 +70,30 @@ EOT
#assert s.check_circular
h = { 1=>2 }
h[3] = h
assert_raises(JSON::CircularDatastructure) { generate(h) }
assert_raises(JSON::CircularDatastructure) { generate(h, s) }
assert_raise(JSON::CircularDatastructure) { generate(h) }
assert_raise(JSON::CircularDatastructure) { generate(h, s) }
s = JSON.state.new(:check_circular => true)
#assert s.check_circular
a = [ 1, 2 ]
a << a
assert_raises(JSON::CircularDatastructure) { generate(a, s) }
assert_raise(JSON::CircularDatastructure) { generate(a, s) }
end
def test_allow_nan
assert_raises(GeneratorError) { generate([JSON::NaN]) }
assert_raise(GeneratorError) { generate([JSON::NaN]) }
assert_equal '[NaN]', generate([JSON::NaN], :allow_nan => true)
assert_equal '[NaN]', fast_generate([JSON::NaN])
assert_raises(GeneratorError) { pretty_generate([JSON::NaN]) }
assert_raise(GeneratorError) { pretty_generate([JSON::NaN]) }
assert_equal "[\n NaN\n]", pretty_generate([JSON::NaN], :allow_nan => true)
assert_raises(GeneratorError) { generate([JSON::Infinity]) }
assert_raise(GeneratorError) { generate([JSON::Infinity]) }
assert_equal '[Infinity]', generate([JSON::Infinity], :allow_nan => true)
assert_equal '[Infinity]', fast_generate([JSON::Infinity])
assert_raises(GeneratorError) { pretty_generate([JSON::Infinity]) }
assert_raise(GeneratorError) { pretty_generate([JSON::Infinity]) }
assert_equal "[\n Infinity\n]", pretty_generate([JSON::Infinity], :allow_nan => true)
assert_raises(GeneratorError) { generate([JSON::MinusInfinity]) }
assert_raise(GeneratorError) { generate([JSON::MinusInfinity]) }
assert_equal '[-Infinity]', generate([JSON::MinusInfinity], :allow_nan => true)
assert_equal '[-Infinity]', fast_generate([JSON::MinusInfinity])
assert_raises(GeneratorError) { pretty_generate([JSON::MinusInfinity]) }
assert_raise(GeneratorError) { pretty_generate([JSON::MinusInfinity]) }
assert_equal "[\n -Infinity\n]", pretty_generate([JSON::MinusInfinity], :allow_nan => true)
end
end

View file

@ -85,7 +85,7 @@ class TC_JSONRails < Test::Unit::TestCase
c = C.new # with rails addition all objects are theoretically creatable
assert C.json_creatable?
json = generate(c)
assert_raises(ArgumentError) { JSON.parse(json) }
assert_raise(ArgumentError) { JSON.parse(json) }
end
def test_raw_strings

View file

@ -50,7 +50,7 @@ class TC_JSONUnicode < Test::Unit::TestCase
assert_equal json, JSON.generate(["" << i])
end
end
assert_raises(JSON::GeneratorError) do
assert_raise(JSON::GeneratorError) do
JSON.generate(["\x80"])
end
assert_equal "\302\200", JSON.parse('["\u0080"]').first

View file

@ -266,7 +266,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
#

View file

@ -215,7 +215,7 @@ class HTTPHeaderTest < Test::Unit::TestCase
try_content_length 123, ' 123'
try_content_length 1, '1 23'
try_content_length 500, '(OK)500'
assert_raises(Net::HTTPHeaderSyntaxError, 'here is no digit, but') {
assert_raise(Net::HTTPHeaderSyntaxError, 'here is no digit, but') {
@c['content-length'] = 'no digit'
@c.content_length
}

View file

@ -65,7 +65,7 @@ class OpenSSL::TestCipher < Test::Unit::TestCase
def test_empty_data
@c1.encrypt
assert_raises(ArgumentError){ @c1.update("") }
assert_raise(ArgumentError){ @c1.update("") }
end
if OpenSSL::OPENSSL_VERSION_NUMBER > 0x00907000

View file

@ -89,7 +89,7 @@ class OpenSSL::TestEC < Test::Unit::TestCase
sig = key.dsa_sign_asn1(@data1)
assert_equal(key.dsa_verify_asn1(@data1, sig), true)
assert_raises(OpenSSL::PKey::ECError) { key.dsa_sign_asn1(@data2) }
assert_raise(OpenSSL::PKey::ECError) { key.dsa_sign_asn1(@data2) }
end
end

View file

@ -236,7 +236,7 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
def test_client_auth
vflag = OpenSSL::SSL::VERIFY_PEER|OpenSSL::SSL::VERIFY_FAIL_IF_NO_PEER_CERT
start_server(PORT, vflag, true){|server, port|
assert_raises(OpenSSL::SSL::SSLError){
assert_raise(OpenSSL::SSL::SSLError){
sock = TCPSocket.new("127.0.0.1", port)
ssl = OpenSSL::SSL::SSLSocket.new(sock)
ssl.connect
@ -375,10 +375,10 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
sock = TCPSocket.new("127.0.0.1", port)
ssl = OpenSSL::SSL::SSLSocket.new(sock)
ssl.connect
assert_raises(sslerr){ssl.post_connection_check("localhost.localdomain")}
assert_raises(sslerr){ssl.post_connection_check("127.0.0.1")}
assert_raise(sslerr){ssl.post_connection_check("localhost.localdomain")}
assert_raise(sslerr){ssl.post_connection_check("127.0.0.1")}
assert(ssl.post_connection_check("localhost"))
assert_raises(sslerr){ssl.post_connection_check("foo.example.com")}
assert_raise(sslerr){ssl.post_connection_check("foo.example.com")}
cert = ssl.peer_cert
assert(!OpenSSL::SSL.verify_certificate_identity(cert, "localhost.localdomain"))
@ -401,8 +401,8 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
ssl.connect
assert(ssl.post_connection_check("localhost.localdomain"))
assert(ssl.post_connection_check("127.0.0.1"))
assert_raises(sslerr){ssl.post_connection_check("localhost")}
assert_raises(sslerr){ssl.post_connection_check("foo.example.com")}
assert_raise(sslerr){ssl.post_connection_check("localhost")}
assert_raise(sslerr){ssl.post_connection_check("foo.example.com")}
cert = ssl.peer_cert
assert(OpenSSL::SSL.verify_certificate_identity(cert, "localhost.localdomain"))
@ -423,9 +423,9 @@ class OpenSSL::TestSSL < Test::Unit::TestCase
ssl = OpenSSL::SSL::SSLSocket.new(sock)
ssl.connect
assert(ssl.post_connection_check("localhost.localdomain"))
assert_raises(sslerr){ssl.post_connection_check("127.0.0.1")}
assert_raises(sslerr){ssl.post_connection_check("localhost")}
assert_raises(sslerr){ssl.post_connection_check("foo.example.com")}
assert_raise(sslerr){ssl.post_connection_check("127.0.0.1")}
assert_raise(sslerr){ssl.post_connection_check("localhost")}
assert_raise(sslerr){ssl.post_connection_check("foo.example.com")}
cert = ssl.peer_cert
assert(OpenSSL::SSL.verify_certificate_identity(cert, "localhost.localdomain"))
assert(!OpenSSL::SSL.verify_certificate_identity(cert, "127.0.0.1"))

View file

@ -157,15 +157,15 @@ class OpenSSL::TestX509Certificate < Test::Unit::TestCase
cert.not_after = Time.now
assert_equal(false, cert.verify(@dsa512))
assert_raises(OpenSSL::X509::CertificateError){
assert_raise(OpenSSL::X509::CertificateError){
cert = issue_cert(@ca, @rsa2048, 1, Time.now, Time.now+3600, [],
nil, nil, OpenSSL::Digest::DSS1.new)
}
assert_raises(OpenSSL::X509::CertificateError){
assert_raise(OpenSSL::X509::CertificateError){
cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
nil, nil, OpenSSL::Digest::MD5.new)
}
assert_raises(OpenSSL::X509::CertificateError){
assert_raise(OpenSSL::X509::CertificateError){
cert = issue_cert(@ca, @dsa512, 1, Time.now, Time.now+3600, [],
nil, nil, OpenSSL::Digest::SHA1.new)
}

View file

@ -198,7 +198,7 @@ class OpenSSL::TestX509Store < Test::Unit::TestCase
nil, nil, OpenSSL::Digest::SHA1.new)
store = OpenSSL::X509::Store.new
store.add_cert(ca1_cert)
assert_raises(OpenSSL::X509::StoreError){
assert_raise(OpenSSL::X509::StoreError){
store.add_cert(ca1_cert) # add same certificate twice
}
@ -209,7 +209,7 @@ class OpenSSL::TestX509Store < Test::Unit::TestCase
crl2 = issue_crl(revoke_info, 2, now+1800, now+3600, [],
ca1_cert, @rsa2048, OpenSSL::Digest::SHA1.new)
store.add_crl(crl1)
assert_raises(OpenSSL::X509::StoreError){
assert_raise(OpenSSL::X509::StoreError){
store.add_crl(crl2) # add CRL issued by same CA twice.
}
end

View file

@ -18,7 +18,7 @@ module TestOptionParser::NoArg
end
def test_short
assert_raises(OptionParser::InvalidOption) {@opt.parse!(%w"-xq")}
assert_raise(OptionParser::InvalidOption) {@opt.parse!(%w"-xq")}
assert_equal(%w"", no_error {@opt.parse!(%w"-x")})
assert_equal(true, @flag)
@flag = nil
@ -27,11 +27,11 @@ module TestOptionParser::NoArg
end
def test_abbrev
assert_raises(OptionParser::InvalidOption) {@opt.parse!(%w"-oq")}
assert_raise(OptionParser::InvalidOption) {@opt.parse!(%w"-oq")}
assert_equal(%w"", no_error {@opt.parse!(%w"-o")})
assert_equal(true, @flag)
@flag = nil
assert_raises(OptionParser::InvalidOption) {@opt.parse!(%w"-O")}
assert_raise(OptionParser::InvalidOption) {@opt.parse!(%w"-O")}
assert_nil(@flag)
@flag = nil
assert_equal(%w"foo", no_error {@opt.parse!(%w"-o foo")})
@ -39,7 +39,7 @@ module TestOptionParser::NoArg
end
def test_long
assert_raises(OptionParser::NeedlessArgument) {@opt.parse!(%w"--option=x")}
assert_raise(OptionParser::NeedlessArgument) {@opt.parse!(%w"--option=x")}
assert_equal(%w"", no_error {@opt.parse!(%w"--opt")})
assert_equal(true, @flag)
@flag = nil
@ -49,8 +49,8 @@ module TestOptionParser::NoArg
def test_ambiguous
@opt.def_option("--open") {|x|}
assert_raises(OptionParser::AmbiguousOption) {@opt.parse!(%w"--op")}
assert_raises(OptionParser::AmbiguousOption) {@opt.parse!(%w"-o")}
assert_raise(OptionParser::AmbiguousOption) {@opt.parse!(%w"--op")}
assert_raise(OptionParser::AmbiguousOption) {@opt.parse!(%w"-o")}
assert_equal(%w"", no_error {@opt.parse!(%w"--opt")})
assert_equal(true, @flag)
end

View file

@ -32,7 +32,7 @@ module TestOptionParser::ReqArg
end
def test_short
assert_raises(OptionParser::MissingArgument) {@opt.parse!(%w"-x")}
assert_raise(OptionParser::MissingArgument) {@opt.parse!(%w"-x")}
assert_equal(%w"", no_error {@opt.parse!(%w"-x foo")})
assert_equal("foo", @flag)
assert_equal(%w"", no_error {@opt.parse!(%w"-xbar")})
@ -42,7 +42,7 @@ module TestOptionParser::ReqArg
end
def test_abbrev
assert_raises(OptionParser::MissingArgument) {@opt.parse!(%w"-o")}
assert_raise(OptionParser::MissingArgument) {@opt.parse!(%w"-o")}
assert_equal(%w"", no_error {@opt.parse!(%w"-o foo")})
assert_equal("foo", @flag)
assert_equal(%w"", no_error {@opt.parse!(%w"-obar")})
@ -52,7 +52,7 @@ module TestOptionParser::ReqArg
end
def test_long
assert_raises(OptionParser::MissingArgument) {@opt.parse!(%w"--opt")}
assert_raise(OptionParser::MissingArgument) {@opt.parse!(%w"--opt")}
assert_equal(%w"", no_error {@opt.parse!(%w"--opt foo")})
assert_equal("foo", @flag)
assert_equal(%w"foo", no_error {@opt.parse!(%w"--opt= foo")})

View file

@ -63,7 +63,7 @@ class TestReadline < Test::Unit::TestCase
["filename_quote_characters"],
]
method_args.each do |method_name, *args|
assert_raises(SecurityError, NotImplementedError,
assert_raise(SecurityError, NotImplementedError,
"method=<#{method_name}>") do
Thread.start {
$SAFE = 4
@ -90,7 +90,7 @@ class TestReadline < Test::Unit::TestCase
assert_equal("> ", stdout.read(2))
assert_equal(1, Readline::HISTORY.length)
assert_equal("hello", Readline::HISTORY[0])
assert_raises(SecurityError) do
assert_raise(SecurityError) do
Thread.start {
$SAFE = 1
replace_stdio(stdin.path, stdout.path) do
@ -98,7 +98,7 @@ class TestReadline < Test::Unit::TestCase
end
}.join
end
assert_raises(SecurityError) do
assert_raise(SecurityError) do
Thread.start {
$SAFE = 4
replace_stdio(stdin.path, stdout.path) { Readline.readline("> ") }

View file

@ -53,7 +53,7 @@ class Readline::TestHistory < Test::Unit::TestCase
["clear", []],
]
method_args.each do |method_name, args|
assert_raises(SecurityError, NotImplementedError,
assert_raise(SecurityError, NotImplementedError,
"method=<#{method_name}>") do
Thread.start {
$SAFE = 4
@ -63,7 +63,7 @@ class Readline::TestHistory < Test::Unit::TestCase
end
end
assert_raises(SecurityError, NotImplementedError,
assert_raise(SecurityError, NotImplementedError,
"method=<each>") do
Thread.start {
$SAFE = 4
@ -123,14 +123,14 @@ class Readline::TestHistory < Test::Unit::TestCase
end
def test_set__out_of_range
assert_raises(IndexError, NotImplementedError, "index=<0>") do
assert_raise(IndexError, NotImplementedError, "index=<0>") do
HISTORY[0] = "set: 0"
end
lines = push_history(5)
invalid_indexes = [5, 6, 100, -6, -7, -100]
invalid_indexes.each do |i|
assert_raises(IndexError, NotImplementedError, "index=<#{i}>") do
assert_raise(IndexError, NotImplementedError, "index=<#{i}>") do
HISTORY[i] = "set: #{i}"
end
end
@ -270,14 +270,14 @@ class Readline::TestHistory < Test::Unit::TestCase
end
def test_delete_at__out_of_range
assert_raises(IndexError, NotImplementedError, "index=<0>") do
assert_raise(IndexError, NotImplementedError, "index=<0>") do
HISTORY.delete_at(0)
end
lines = push_history(5)
invalid_indexes = [5, 6, 100, -6, -7, -100]
invalid_indexes.each do |i|
assert_raises(IndexError, NotImplementedError, "index=<#{i}>") do
assert_raise(IndexError, NotImplementedError, "index=<#{i}>") do
HISTORY.delete_at(i)
end
end
@ -285,7 +285,7 @@ class Readline::TestHistory < Test::Unit::TestCase
invalid_indexes = [100_000_000_000_000_000_000,
-100_000_000_000_000_000_000]
invalid_indexes.each do |i|
assert_raises(RangeError, NotImplementedError, "index=<#{i}>") do
assert_raise(RangeError, NotImplementedError, "index=<#{i}>") do
HISTORY.delete_at(i)
end
end

View file

@ -149,7 +149,7 @@ module TupleSpaceTestModule
assert(!tmpl.match({"message"=>"Hi", "name"=>"Foo", "age"=>1}))
assert(!tmpl.match({"message"=>"Hello", "no_name"=>"Foo"}))
assert_raises(Rinda::InvalidHashTupleKey) do
assert_raise(Rinda::InvalidHashTupleKey) do
tmpl = Rinda::Template.new({:message=>String, "name"=>String})
end
tmpl = Rinda::Template.new({"name"=>String})
@ -182,7 +182,7 @@ module TupleSpaceTestModule
assert(!tmpl.match({"message"=>"Hi", "name"=>"Foo", "age"=>1}))
assert(!tmpl.match({"message"=>"Hello", "no_name"=>"Foo"}))
assert_raises(Rinda::InvalidHashTupleKey) do
assert_raise(Rinda::InvalidHashTupleKey) do
@ts.write({:message=>String, "name"=>String})
end
@ -193,7 +193,7 @@ module TupleSpaceTestModule
assert_equal({'1'=>1, '2'=>2, '3'=>3}, @ts.take({'1'=>1, '2'=>2, '3'=>3}))
entry = @ts.write(['1'=>1, '2'=>2, '3'=>3])
assert_raises(Rinda::RequestExpiredError) do
assert_raise(Rinda::RequestExpiredError) do
assert_equal({'1'=>1, '2'=>2, '3'=>3}, @ts.read({'1'=>1}, 0))
end
entry.cancel
@ -230,11 +230,11 @@ module TupleSpaceTestModule
end
def test_inp_rdp
assert_raises(Rinda::RequestExpiredError) do
assert_raise(Rinda::RequestExpiredError) do
@ts.take([:empty], 0)
end
assert_raises(Rinda::RequestExpiredError) do
assert_raise(Rinda::RequestExpiredError) do
@ts.read([:empty], 0)
end
end
@ -242,13 +242,13 @@ module TupleSpaceTestModule
def test_ruby_talk_264062
th = Thread.new { @ts.take([:empty], 1) }
sleep(10)
assert_raises(Rinda::RequestExpiredError) do
assert_raise(Rinda::RequestExpiredError) do
thread_join(th)
end
th = Thread.new { @ts.read([:empty], 1) }
sleep(10)
assert_raises(Rinda::RequestExpiredError) do
assert_raise(Rinda::RequestExpiredError) do
thread_join(th)
end
end
@ -429,7 +429,7 @@ module TupleSpaceTestModule
sleep(2)
assert_raises(Rinda::RequestCanceledError) do
assert_raise(Rinda::RequestCanceledError) do
assert_nil(thread_join(taker))
end
@ -458,7 +458,7 @@ module TupleSpaceTestModule
sleep(2)
assert_raises(Rinda::RequestCanceledError) do
assert_raise(Rinda::RequestCanceledError) do
assert_nil(thread_join(reader))
end

View file

@ -128,7 +128,7 @@ module MarshalTestLib
def test_hash_default_proc
h = Hash.new {}
assert_raises(TypeError) { marshaltest(h) }
assert_raise(TypeError) { marshaltest(h) }
end
def test_hash_ivar
@ -418,16 +418,16 @@ module MarshalTestLib
def test_singleton
o = Object.new
def o.m() end
assert_raises(TypeError) { marshaltest(o) }
assert_raise(TypeError) { marshaltest(o) }
o = Object.new
c = class << o
@v = 1
class C; self; end
end
assert_raises(TypeError) { marshaltest(o) }
assert_raises(TypeError) { marshaltest(c) }
assert_raises(TypeError) { marshaltest(ARGF) }
assert_raises(TypeError) { marshaltest(ENV) }
assert_raise(TypeError) { marshaltest(o) }
assert_raise(TypeError) { marshaltest(c) }
assert_raise(TypeError) { marshaltest(ARGF) }
assert_raise(TypeError) { marshaltest(ENV) }
end
def test_extend
@ -440,7 +440,7 @@ module MarshalTestLib
marshal_equal(o) {|obj| class << obj; ancestors end}
o = Object.new
o.extend Module.new
assert_raises(TypeError) { marshaltest(o) }
assert_raise(TypeError) { marshaltest(o) }
end
def test_extend_string
@ -453,16 +453,16 @@ module MarshalTestLib
marshal_equal(o) {|obj| class << obj; ancestors end}
o = ""
o.extend Module.new
assert_raises(TypeError) { marshaltest(o) }
assert_raise(TypeError) { marshaltest(o) }
end
def test_anonymous
c = Class.new
assert_raises(TypeError) { marshaltest(c) }
assert_raise(TypeError) { marshaltest(c) }
o = c.new
assert_raises(TypeError) { marshaltest(o) }
assert_raise(TypeError) { marshaltest(o) }
m = Module.new
assert_raises(TypeError) { marshaltest(m) }
assert_raise(TypeError) { marshaltest(m) }
end
def test_string_empty

View file

@ -32,11 +32,11 @@ class TestBeginEndBlock < Test::Unit::TestCase
end
def test_begininmethod
assert_raises(SyntaxError) do
assert_raise(SyntaxError) do
eval("def foo; BEGIN {}; end")
end
assert_raises(SyntaxError) do
assert_raise(SyntaxError) do
eval('eval("def foo; BEGIN {}; end")')
end
end

View file

@ -8,8 +8,8 @@ class TestCall < Test::Unit::TestCase
end
def test_call
assert_raises(ArgumentError) {aaa()}
assert_raises(ArgumentError) {aaa}
assert_raise(ArgumentError) {aaa()}
assert_raise(ArgumentError) {aaa}
assert_equal([1, 100], aaa(1))
assert_equal([1, 2], aaa(1, 2))

View file

@ -21,7 +21,7 @@ class TestClone < Test::Unit::TestCase
assert_equal("test", bar.test)
assert_equal("test", foo.test)
assert_raises(NoMethodError) {foo.test2}
assert_raise(NoMethodError) {foo.test2}
assert_equal([M003, M002, M001], M003.ancestors)
end

View file

@ -36,13 +36,13 @@ class TestEnv < Test::Unit::TestCase
assert_equal('foo', ENV['test'])
end
assert_raises(TypeError) {
assert_raise(TypeError) {
tmp = ENV[1]
}
assert_raises(TypeError) {
assert_raise(TypeError) {
ENV[1] = 'foo'
}
assert_raises(TypeError) {
assert_raise(TypeError) {
ENV['test'] = 0
}
end

View file

@ -24,7 +24,7 @@ class TestException < Test::Unit::TestCase
# exception in rescue clause
$string = "this must be handled no.3"
e = assert_raises(RuntimeError) do
e = assert_raise(RuntimeError) do
begin
raise "exception in rescue clause"
rescue
@ -36,7 +36,7 @@ class TestException < Test::Unit::TestCase
# exception in ensure clause
$string = "exception in ensure clause"
e = assert_raises(RuntimeError) do
e = assert_raise(RuntimeError) do
begin
raise "this must be handled no.4"
ensure

View file

@ -54,7 +54,7 @@ class TestIterator < Test::Unit::TestCase
tt{|i| break if i == 5}
assert_equal(0, i)
assert_raises(ArgumentError) do
assert_raise(ArgumentError) do
tt3{}
end
end
@ -64,7 +64,7 @@ class TestIterator < Test::Unit::TestCase
end
def test_block_argument_without_paren
assert_raises(ArgumentError) do
assert_raise(ArgumentError) do
tt4{}
end
end
@ -216,10 +216,10 @@ class TestIterator < Test::Unit::TestCase
def test_argument
assert_nothing_raised {lambda{||}.call}
assert_raises(ArgumentError) {lambda{||}.call(1)}
assert_raise(ArgumentError) {lambda{||}.call(1)}
assert_nothing_raised {lambda{|a,|}.call(1)}
assert_raises(ArgumentError) {lambda{|a,|}.call()}
assert_raises(ArgumentError) {lambda{|a,|}.call(1,2)}
assert_raise(ArgumentError) {lambda{|a,|}.call()}
assert_raise(ArgumentError) {lambda{|a,|}.call(1,2)}
end
def get_block(&block)
@ -235,9 +235,9 @@ class TestIterator < Test::Unit::TestCase
assert_nothing_raised {get_block{|a,|}.call(1,2)}
assert_nothing_raised {get_block(&lambda{||}).call()}
assert_raises(ArgumentError) {get_block(&lambda{||}).call(1)}
assert_raise(ArgumentError) {get_block(&lambda{||}).call(1)}
assert_nothing_raised {get_block(&lambda{|a,|}).call(1)}
assert_raises(ArgumentError) {get_block(&lambda{|a,|}).call(1,2)}
assert_raise(ArgumentError) {get_block(&lambda{|a,|}).call(1,2)}
block = get_block{11}
assert_instance_of(Proc, block)
@ -298,7 +298,7 @@ class TestIterator < Test::Unit::TestCase
end
def test_ljump
assert_raises(LocalJumpError) {get_block{break}.call}
assert_raise(LocalJumpError) {get_block{break}.call}
# cannot use assert_nothing_raised due to passing block.
begin
@ -483,7 +483,7 @@ class TestIterator < Test::Unit::TestCase
assert_equal(1, e.next)
assert_equal(2, e.next)
assert_equal(3, e.next)
assert_raises(StopIteration){e.next}
assert_raise(StopIteration){e.next}
e.rewind
assert_equal(1, e.next)
e.rewind

View file

@ -9,17 +9,17 @@ class TestLambdaParameters < Test::Unit::TestCase
def test_call_simple
assert_equal(1, lambda{|a| a}.call(1))
assert_equal([1,2], lambda{|a, b| [a,b]}.call(1,2))
assert_raises(ArgumentError) { lambda{|a|}.call(1,2) }
assert_raises(ArgumentError) { lambda{|a|}.call() }
assert_raises(ArgumentError) { lambda{}.call(1) }
assert_raises(ArgumentError) { lambda{|a, b|}.call(1,2,3) }
assert_raise(ArgumentError) { lambda{|a|}.call(1,2) }
assert_raise(ArgumentError) { lambda{|a|}.call() }
assert_raise(ArgumentError) { lambda{}.call(1) }
assert_raise(ArgumentError) { lambda{|a, b|}.call(1,2,3) }
assert_equal(1, ->(a){ a }.call(1))
assert_equal([1,2], ->(a,b){ [a,b] }.call(1,2))
assert_raises(ArgumentError) { ->(a){ }.call(1,2) }
assert_raises(ArgumentError) { ->(a){ }.call() }
assert_raises(ArgumentError) { ->(){ }.call(1) }
assert_raises(ArgumentError) { ->(a,b){ }.call(1,2,3) }
assert_raise(ArgumentError) { ->(a){ }.call(1,2) }
assert_raise(ArgumentError) { ->(a){ }.call() }
assert_raise(ArgumentError) { ->(){ }.call(1) }
assert_raise(ArgumentError) { ->(a,b){ }.call(1,2,3) }
end
end
@ -34,21 +34,21 @@ __END__
def test_call_rest_args
assert_equal([1,2], ->(*a){ a }.call(1,2))
assert_equal([1,2,[]], ->(a,b,*c){ [a,b,c] }.call(1,2))
assert_raises(ArgumentError){ ->(a,*b){ }.call() }
assert_raise(ArgumentError){ ->(a,*b){ }.call() }
end
def test_call_opt_args
assert_equal([1,2,3,4], ->(a,b,c=3,d=4){ [a,b,c,d] }.call(1,2))
assert_equal([1,2,3,4], ->(a,b,c=0,d=4){ [a,b,c,d] }.call(1,2,3))
assert_raises(ArgumentError){ ->(a,b=1){ }.call() }
assert_raises(ArgumentError){ ->(a,b=1){ }.call(1,2,3) }
assert_raise(ArgumentError){ ->(a,b=1){ }.call() }
assert_raise(ArgumentError){ ->(a,b=1){ }.call(1,2,3) }
end
def test_call_rest_and_opt
assert_equal([1,2,3,[]], ->(a,b=2,c=3,*d){ [a,b,c,d] }.call(1))
assert_equal([1,2,3,[]], ->(a,b=0,c=3,*d){ [a,b,c,d] }.call(1,2))
assert_equal([1,2,3,[4,5,6]], ->(a,b=0,c=0,*d){ [a,b,c,d] }.call(1,2,3,4,5,6))
assert_raises(ArgumentError){ ->(a,b=1,*c){ }.call() }
assert_raise(ArgumentError){ ->(a,b=1,*c){ }.call() }
end
def test_call_with_block

View file

@ -47,15 +47,15 @@ class TestPack < Test::Unit::TestCase
end
def test_pack_U
assert_raises(RangeError) { [-0x40000001].pack("U") }
assert_raises(RangeError) { [-0x40000000].pack("U") }
assert_raises(RangeError) { [-1].pack("U") }
assert_raise(RangeError) { [-0x40000001].pack("U") }
assert_raise(RangeError) { [-0x40000000].pack("U") }
assert_raise(RangeError) { [-1].pack("U") }
assert_equal "\000", [0].pack("U")
assert_equal "\374\277\277\277\277\277", [0x3fffffff].pack("U")
assert_equal "\375\200\200\200\200\200", [0x40000000].pack("U")
assert_equal "\375\277\277\277\277\277", [0x7fffffff].pack("U")
assert_raises(RangeError) { [0x80000000].pack("U") }
assert_raises(RangeError) { [0x100000000].pack("U") }
assert_raise(RangeError) { [0x80000000].pack("U") }
assert_raise(RangeError) { [0x100000000].pack("U") }
end
def test_pack_P

View file

@ -38,8 +38,8 @@ class TestReadPartial < Test::Unit::TestCase
w.close
assert_equal('ab', r.readpartial(2))
assert_equal('c', r.readpartial(2))
assert_raises(EOFError) { r.readpartial(2) }
assert_raises(EOFError) { r.readpartial(2) }
assert_raise(EOFError) { r.readpartial(2) }
assert_raise(EOFError) { r.readpartial(2) }
}
end
@ -48,7 +48,7 @@ class TestReadPartial < Test::Unit::TestCase
w << 'abc'
assert_equal('ab', r.readpartial(2))
assert_equal('c', r.readpartial(2))
assert_raises(TimeoutError) {
assert_raise(TimeoutError) {
timeout(0.1) { r.readpartial(2) }
}
}
@ -62,7 +62,7 @@ class TestReadPartial < Test::Unit::TestCase
assert_equal("de", r.readpartial(2))
assert_equal("f\n", r.readpartial(4096))
assert_equal("ghi\n", r.readpartial(4096))
assert_raises(TimeoutError) {
assert_raise(TimeoutError) {
timeout(0.1) { r.readpartial(2) }
}
}

View file

@ -21,7 +21,7 @@ class TestSignal < Test::Unit::TestCase
assert_equal 2, x
Signal.trap(:INT) { raise "Interrupt" }
ex = assert_raises(RuntimeError) {
ex = assert_raise(RuntimeError) {
Process.kill :INT, Process.pid
sleep 0.1
}

View file

@ -71,7 +71,7 @@ class TestThread < Test::Unit::TestCase
mutex = Mutex.new
condvar = ConditionVariable.new
assert_raises(ThreadError) { condvar.wait(mutex) }
assert_raise(ThreadError) { condvar.wait(mutex) }
end
def test_condvar_wait_exception_handling
@ -98,7 +98,7 @@ class TestThread < Test::Unit::TestCase
end
thread.raise Interrupt, "interrupt a dead condition variable"
assert_raises(Interrupt) { thread.value }
assert_raise(Interrupt) { thread.value }
assert(locked)
end

View file

@ -37,7 +37,7 @@ class TestVariable < Test::Unit::TestCase
assert_instance_of(Fixnum, $$)
# read-only variable
assert_raises(NameError) do
assert_raise(NameError) do
$$ = 5
end

View file

@ -25,7 +25,7 @@ class TestGemBuilder < RubyGemTestCase
def test_build_validates
builder = Gem::Builder.new Gem::Specification.new
assert_raises Gem::InvalidSpecificationException do
assert_raise Gem::InvalidSpecificationException do
builder.build
end
end

View file

@ -31,7 +31,7 @@ class TestGemCommandManager < RubyGemTestCase
def test_run_interrupt
use_ui @ui do
@command_manager.register_command :interrupt
assert_raises MockGemUi::TermError do
assert_raise MockGemUi::TermError do
@command_manager.run 'interrupt'
end
assert_equal '', ui.output
@ -41,7 +41,7 @@ class TestGemCommandManager < RubyGemTestCase
def test_process_args_bad_arg
use_ui @ui do
assert_raises(MockGemUi::TermError) {
assert_raise(MockGemUi::TermError) {
@command_manager.process_args("--bad-arg")
}
end

View file

@ -43,7 +43,7 @@ class TestGemCommandsInstallCommand < RubyGemTestCase
orig_dir = Dir.pwd
begin
Dir.chdir @tempdir
e = assert_raises Gem::SystemExitException do
e = assert_raise Gem::SystemExitException do
@cmd.execute
end
assert_equal 0, e.exit_code
@ -65,7 +65,7 @@ class TestGemCommandsInstallCommand < RubyGemTestCase
@cmd.options[:args] = %w[no_such_gem]
use_ui @ui do
e = assert_raises Gem::SystemExitException do
e = assert_raise Gem::SystemExitException do
@cmd.execute
end
assert_equal 2, e.exit_code
@ -91,7 +91,7 @@ class TestGemCommandsInstallCommand < RubyGemTestCase
@cmd.options[:args] = %w[nonexistent]
use_ui @ui do
e = assert_raises Gem::SystemExitException do
e = assert_raise Gem::SystemExitException do
@cmd.execute
end
assert_equal 2, e.exit_code
@ -114,7 +114,7 @@ class TestGemCommandsInstallCommand < RubyGemTestCase
@cmd.options[:args] = [@a2.name]
use_ui @ui do
e = assert_raises Gem::SystemExitException do
e = assert_raise Gem::SystemExitException do
@cmd.execute
end
assert_equal 0, e.exit_code
@ -146,7 +146,7 @@ class TestGemCommandsInstallCommand < RubyGemTestCase
orig_dir = Dir.pwd
begin
Dir.chdir @tempdir
e = assert_raises Gem::SystemExitException do
e = assert_raise Gem::SystemExitException do
@cmd.execute
end
assert_equal 0, e.exit_code

View file

@ -52,7 +52,7 @@ class TestGemInstallUpdateOptions < GemInstallerTestCase
File.chmod 0755, @userhome
FileUtils.chmod 0000, @gemhome
assert_raises(Gem::FilePermissionError) do
assert_raise(Gem::FilePermissionError) do
@installer = Gem::Installer.new @gem, @cmd.options
end
ensure

View file

@ -287,7 +287,7 @@ load 'my_exec'
Dir.mkdir util_inst_bindir
File.chmod 0000, util_inst_bindir
assert_raises Gem::FilePermissionError do
assert_raise Gem::FilePermissionError do
@installer.generate_bin
end
@ -372,7 +372,7 @@ load 'my_exec'
Dir.mkdir util_inst_bindir
File.chmod 0000, util_inst_bindir
assert_raises Gem::FilePermissionError do
assert_raise Gem::FilePermissionError do
@installer.generate_bin
end

View file

@ -62,19 +62,19 @@ class TestGemPackageTarHeader < TarTestCase
end
def test_initialize_bad
assert_raises ArgumentError do
assert_raise ArgumentError do
Gem::Package::TarHeader.new :name => '', :size => '', :mode => ''
end
assert_raises ArgumentError do
assert_raise ArgumentError do
Gem::Package::TarHeader.new :name => '', :size => '', :prefix => ''
end
assert_raises ArgumentError do
assert_raise ArgumentError do
Gem::Package::TarHeader.new :name => '', :prefix => '', :mode => ''
end
assert_raises ArgumentError do
assert_raise ArgumentError do
Gem::Package::TarHeader.new :prefix => '', :size => '', :mode => ''
end
end

View file

@ -63,7 +63,7 @@ class TestGemStreamUI < RubyGemTestCase
@in.tty = false
timeout(0.1) do
assert_raises(Gem::OperationNotSupportedError) do
assert_raise(Gem::OperationNotSupportedError) do
@sui.ask_yes_no("do coconuts migrate?")
end
end

View file

@ -107,7 +107,7 @@ class TestGemVersion < RubyGemTestCase
def test_illformed_requirements
[ ">>> 1.3.5", "> blah" ].each do |rq|
assert_raises(ArgumentError, "req [#{rq}] should fail") {
assert_raise(ArgumentError, "req [#{rq}] should fail") {
Gem::Version::Requirement.new(rq)
}
end

View file

@ -31,8 +31,8 @@ class TestStringScanner < Test::Unit::TestCase
def test_s_allocate
s = StringScanner.allocate
assert_equal '#<StringScanner (uninitialized)>', s.inspect.sub(/StringScanner_C/, 'StringScanner')
assert_raises(UNINIT_ERROR) { s.eos? }
assert_raises(UNINIT_ERROR) { s.scan(/a/) }
assert_raise(UNINIT_ERROR) { s.eos? }
assert_raise(UNINIT_ERROR) { s.scan(/a/) }
s.string = 'test'
assert_equal '#<StringScanner 0/4 @ "test">', s.inspect.sub(/StringScanner_C/, 'StringScanner')
assert_nothing_raised(UNINIT_ERROR) { s.eos? }

View file

@ -18,21 +18,21 @@ class TestShellwords < Test::Unit::TestCase
def test_unmatched_double_quote
bad_cmd = 'one two "three'
assert_raises ArgumentError do
assert_raise ArgumentError do
shellwords(bad_cmd)
end
end
def test_unmatched_single_quote
bad_cmd = "one two 'three"
assert_raises ArgumentError do
assert_raise ArgumentError do
shellwords(bad_cmd)
end
end
def test_unmatched_quotes
bad_cmd = "one '"'"''""'""
assert_raises ArgumentError do
assert_raise ArgumentError do
shellwords(bad_cmd)
end
end

View file

@ -18,7 +18,7 @@ module Test
end
def test_simple_observation
assert_raises(ArgumentError, "add_listener should throw an exception if no callback is supplied") do
assert_raise(ArgumentError, "add_listener should throw an exception if no callback is supplied") do
@observable.add_listener(:property, "a")
end
@ -71,7 +71,7 @@ module Test
end
def test_add_remove_with_default_listener
assert_raises(ArgumentError, "add_listener should throw an exception if no callback is supplied") do
assert_raise(ArgumentError, "add_listener should throw an exception if no callback is supplied") do
@observable.add_listener(:property)
end

View file

@ -52,7 +52,7 @@ class TestFTP < Test::Unit::TestCase
u = URI.parse('ftp://a.b.c/')
ary = u.component.collect {|c| u.send(c)}
assert_equal(ary, u.select(*u.component))
assert_raises(ArgumentError) do
assert_raise(ArgumentError) do
u.select(:scheme, :host, :not_exist, :port)
end
end

View file

@ -121,8 +121,8 @@ class URI::TestGeneric < Test::Unit::TestCase
# 7
# reported by Mr. Kubota <em6t-kbt@asahi-net.or.jp>
assert_raises(URI::InvalidURIError) { URI.parse('http://a_b:80/') }
assert_raises(URI::InvalidURIError) { URI.parse('http://a_b/') }
assert_raise(URI::InvalidURIError) { URI.parse('http://a_b:80/') }
assert_raise(URI::InvalidURIError) { URI.parse('http://a_b/') }
# 8
# reported by m_seki
@ -680,19 +680,19 @@ class URI::TestGeneric < Test::Unit::TestCase
assert_equal('http://foo:bar@zab:8080/?a=1#b123', uri.to_s)
uri = URI.parse('http://example.com')
assert_raises(URI::InvalidURIError) { uri.password = 'bar' }
assert_raise(URI::InvalidURIError) { uri.password = 'bar' }
uri.userinfo = 'foo:bar'
assert_equal('http://foo:bar@example.com', uri.to_s)
assert_raises(URI::InvalidURIError) { uri.registry = 'bar' }
assert_raises(URI::InvalidURIError) { uri.opaque = 'bar' }
assert_raise(URI::InvalidURIError) { uri.registry = 'bar' }
assert_raise(URI::InvalidURIError) { uri.opaque = 'bar' }
uri = URI.parse('mailto:foo@example.com')
assert_raises(URI::InvalidURIError) { uri.user = 'bar' }
assert_raises(URI::InvalidURIError) { uri.password = 'bar' }
assert_raises(URI::InvalidURIError) { uri.userinfo = ['bar', 'baz'] }
assert_raises(URI::InvalidURIError) { uri.host = 'bar' }
assert_raises(URI::InvalidURIError) { uri.port = 'bar' }
assert_raises(URI::InvalidURIError) { uri.path = 'bar' }
assert_raises(URI::InvalidURIError) { uri.query = 'bar' }
assert_raise(URI::InvalidURIError) { uri.user = 'bar' }
assert_raise(URI::InvalidURIError) { uri.password = 'bar' }
assert_raise(URI::InvalidURIError) { uri.userinfo = ['bar', 'baz'] }
assert_raise(URI::InvalidURIError) { uri.host = 'bar' }
assert_raise(URI::InvalidURIError) { uri.port = 'bar' }
assert_raise(URI::InvalidURIError) { uri.path = 'bar' }
assert_raise(URI::InvalidURIError) { uri.query = 'bar' }
end
end

View file

@ -53,7 +53,7 @@ class TestHTTP < Test::Unit::TestCase
assert_equal(['http', 'a.b.c', 80], URI.parse('http://a.b.c/').select(:scheme, :host, :port))
u = URI.parse('http://a.b.c/')
assert_equal(uri_to_ary(u), u.select(*u.component))
assert_raises(ArgumentError) do
assert_raise(ArgumentError) do
u.select(:scheme, :host, :not_exist, :port)
end
end

View file

@ -90,7 +90,7 @@ class TestLDAP < Test::Unit::TestCase
def test_select
u = URI.parse('ldap:///??sub??!bindname=cn=Manager%2co=Foo')
assert_equal(uri_to_ary(u), u.select(*u.component))
assert_raises(ArgumentError) do
assert_raise(ArgumentError) do
u.select(:scheme, :host, :not_exist, :port)
end
end

View file

@ -101,7 +101,7 @@ class TestMailTo < Test::Unit::TestCase
end
bad.each do |x|
assert_raises(URI::InvalidComponentError) {
assert_raise(URI::InvalidComponentError) {
@u.build(x)
}
end
@ -112,7 +112,7 @@ class TestMailTo < Test::Unit::TestCase
def test_select
u = URI.parse('mailto:joe@example.com?cc=bob@example.com&body=hello')
assert_equal(uri_to_ary(u), u.select(*u.component))
assert_raises(ArgumentError) do
assert_raise(ArgumentError) do
u.select(:scheme, :host, :not_exist, :port)
end
end

View file

@ -66,7 +66,7 @@ class TestWEBrickHTTPAuth < Test::Unit::TestCase
tmpfile = Tempfile.new("test_webrick_auth")
tmpfile.puts("webrick:{SHA}GJYFRpBbdchp595jlh3Bhfmgp8k=")
tmpfile.flush
assert_raises(NotImplementedError){
assert_raise(NotImplementedError){
WEBrick::HTTPAuth::Htpasswd.new(tmpfile.path)
}
tmpfile.close(true)
@ -74,7 +74,7 @@ class TestWEBrickHTTPAuth < Test::Unit::TestCase
tmpfile = Tempfile.new("test_webrick_auth")
tmpfile.puts("webrick:$apr1$IOVMD/..$rmnOSPXr0.wwrLPZHBQZy0")
tmpfile.flush
assert_raises(NotImplementedError){
assert_raise(NotImplementedError){
WEBrick::HTTPAuth::Htpasswd.new(tmpfile.path)
}
tmpfile.close(true)

View file

@ -61,7 +61,7 @@ class TestWEBrickHTTPRequest < Test::Unit::TestCase
GET /#{"a"*1024} HTTP/1.1
_end_of_message_
req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
assert_raises(WEBrick::HTTPStatus::RequestURITooLarge){
assert_raise(WEBrick::HTTPStatus::RequestURITooLarge){
req.parse(StringIO.new(msg.gsub(/^ {6}/, "")))
}
end
@ -314,7 +314,7 @@ class TestWEBrickHTTPRequest < Test::Unit::TestCase
#{param}
_end_of_message_
assert_raises(WEBrick::HTTPStatus::LengthRequired){
assert_raise(WEBrick::HTTPStatus::LengthRequired){
req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
req.parse(StringIO.new(msg.gsub(/^ {6}/, "")))
req.body
@ -327,7 +327,7 @@ class TestWEBrickHTTPRequest < Test::Unit::TestCase
body is too short.
_end_of_message_
assert_raises(WEBrick::HTTPStatus::BadRequest){
assert_raise(WEBrick::HTTPStatus::BadRequest){
req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
req.parse(StringIO.new(msg.gsub(/^ {6}/, "")))
req.body
@ -340,7 +340,7 @@ class TestWEBrickHTTPRequest < Test::Unit::TestCase
body is too short.
_end_of_message_
assert_raises(WEBrick::HTTPStatus::NotImplemented){
assert_raise(WEBrick::HTTPStatus::NotImplemented){
req = WEBrick::HTTPRequest.new(WEBrick::Config::HTTP)
req.parse(StringIO.new(msg.gsub(/^ {6}/, "")))
req.body

View file

@ -30,24 +30,24 @@ class TestWEBrickHTTPUtils < Test::Unit::TestCase
assert_equal("/foo/bar/", normalize_path("//foo///.//bar/.///.//"))
assert_equal("/", normalize_path("//foo///..///bar/.///..//.//"))
assert_raises(RuntimeError){ normalize_path("foo/bar") }
assert_raises(RuntimeError){ normalize_path("..") }
assert_raises(RuntimeError){ normalize_path("/..") }
assert_raises(RuntimeError){ normalize_path("/./..") }
assert_raises(RuntimeError){ normalize_path("/./../") }
assert_raises(RuntimeError){ normalize_path("/./../..") }
assert_raises(RuntimeError){ normalize_path("/./../../") }
assert_raises(RuntimeError){ normalize_path("/./../") }
assert_raises(RuntimeError){ normalize_path("/../..") }
assert_raises(RuntimeError){ normalize_path("/../../") }
assert_raises(RuntimeError){ normalize_path("/../../..") }
assert_raises(RuntimeError){ normalize_path("/../../../") }
assert_raises(RuntimeError){ normalize_path("/../foo/../") }
assert_raises(RuntimeError){ normalize_path("/../foo/../../") }
assert_raises(RuntimeError){ normalize_path("/foo/bar/../../../../") }
assert_raises(RuntimeError){ normalize_path("/foo/../bar/../../") }
assert_raises(RuntimeError){ normalize_path("/./../bar/") }
assert_raises(RuntimeError){ normalize_path("/./../") }
assert_raise(RuntimeError){ normalize_path("foo/bar") }
assert_raise(RuntimeError){ normalize_path("..") }
assert_raise(RuntimeError){ normalize_path("/..") }
assert_raise(RuntimeError){ normalize_path("/./..") }
assert_raise(RuntimeError){ normalize_path("/./../") }
assert_raise(RuntimeError){ normalize_path("/./../..") }
assert_raise(RuntimeError){ normalize_path("/./../../") }
assert_raise(RuntimeError){ normalize_path("/./../") }
assert_raise(RuntimeError){ normalize_path("/../..") }
assert_raise(RuntimeError){ normalize_path("/../../") }
assert_raise(RuntimeError){ normalize_path("/../../..") }
assert_raise(RuntimeError){ normalize_path("/../../../") }
assert_raise(RuntimeError){ normalize_path("/../foo/../") }
assert_raise(RuntimeError){ normalize_path("/../foo/../../") }
assert_raise(RuntimeError){ normalize_path("/foo/bar/../../../../") }
assert_raise(RuntimeError){ normalize_path("/foo/../bar/../../") }
assert_raise(RuntimeError){ normalize_path("/./../bar/") }
assert_raise(RuntimeError){ normalize_path("/./../") }
end
def test_split_header_value

View file

@ -16,9 +16,9 @@ class TestWEBrickUtils < Test::Unit::TestCase
assert_expired(true, m)
i = 0
assert_raises(Timeout::Error){
assert_raise(Timeout::Error){
m.timeout(2){
assert_raises(Timeout::Error){ m.timeout(1){ i += 1; sleep } }
assert_raise(Timeout::Error){ m.timeout(1){ i += 1; sleep } }
assert_expired(false, m)
i += 1
sleep
@ -27,14 +27,14 @@ class TestWEBrickUtils < Test::Unit::TestCase
assert_equal(2, i)
assert_expired(true, m)
assert_raises(Timeout::Error){ m.timeout(0.1){ sleep } }
assert_raise(Timeout::Error){ m.timeout(0.1){ sleep } }
assert_expired(true, m)
assert_raises(ex){ m.timeout(0.1, ex){ sleep } }
assert_raise(ex){ m.timeout(0.1, ex){ sleep } }
assert_expired(true, m)
i = 0
assert_raises(ex){
assert_raise(ex){
m.timeout(10){
m.timeout(1, ex){ i += 1; sleep }
}
@ -44,7 +44,7 @@ class TestWEBrickUtils < Test::Unit::TestCase
assert_expired(true, m)
i = 0
assert_raises(Timeout::Error){
assert_raise(Timeout::Error){
m.timeout(1){
m.timeout(10, ex){ i += 1; sleep }
}

View file

@ -10,18 +10,18 @@ class Test_DateTime < Test::Unit::TestCase
end
def test_new_exception
assert_raises(ArgumentError) { XMLRPC::DateTime.new(4.5, 13, 32, 25, 60, 60) }
assert_raises(ArgumentError) { XMLRPC::DateTime.new(2001, 12, 32, 25, 60, 60) }
assert_raises(ArgumentError) { XMLRPC::DateTime.new(2001, 12, 31, 25, 60, 60) }
assert_raises(ArgumentError) { XMLRPC::DateTime.new(2001, 12, 31, 24, 60, 60) }
assert_raises(ArgumentError) { XMLRPC::DateTime.new(2001, 12, 31, 24, 59, 60) }
assert_raise(ArgumentError) { XMLRPC::DateTime.new(4.5, 13, 32, 25, 60, 60) }
assert_raise(ArgumentError) { XMLRPC::DateTime.new(2001, 12, 32, 25, 60, 60) }
assert_raise(ArgumentError) { XMLRPC::DateTime.new(2001, 12, 31, 25, 60, 60) }
assert_raise(ArgumentError) { XMLRPC::DateTime.new(2001, 12, 31, 24, 60, 60) }
assert_raise(ArgumentError) { XMLRPC::DateTime.new(2001, 12, 31, 24, 59, 60) }
assert_nothing_raised(ArgumentError) { XMLRPC::DateTime.new(2001, 12, 31, 24, 59, 59) }
assert_raises(ArgumentError) { XMLRPC::DateTime.new(2001, 0, 0, -1, -1, -1) }
assert_raises(ArgumentError) { XMLRPC::DateTime.new(2001, 1, 0, -1, -1, -1) }
assert_raises(ArgumentError) { XMLRPC::DateTime.new(2001, 1, 1, -1, -1, -1) }
assert_raises(ArgumentError) { XMLRPC::DateTime.new(2001, 1, 1, 0, -1, -1) }
assert_raises(ArgumentError) { XMLRPC::DateTime.new(2001, 1, 1, 0, 0, -1) }
assert_raise(ArgumentError) { XMLRPC::DateTime.new(2001, 0, 0, -1, -1, -1) }
assert_raise(ArgumentError) { XMLRPC::DateTime.new(2001, 1, 0, -1, -1, -1) }
assert_raise(ArgumentError) { XMLRPC::DateTime.new(2001, 1, 1, -1, -1, -1) }
assert_raise(ArgumentError) { XMLRPC::DateTime.new(2001, 1, 1, 0, -1, -1) }
assert_raise(ArgumentError) { XMLRPC::DateTime.new(2001, 1, 1, 0, 0, -1) }
assert_nothing_raised(ArgumentError) { XMLRPC::DateTime.new(2001, 1, 1, 0, 0, 0) }
end
@ -68,31 +68,31 @@ class Test_DateTime < Test::Unit::TestCase
def test_set_exception
dt = createDateTime()
assert_raises(ArgumentError) { dt.year = 4.5 }
assert_raise(ArgumentError) { dt.year = 4.5 }
assert_nothing_raised(ArgumentError) { dt.year = -2000 }
assert_raises(ArgumentError) { dt.month = 0 }
assert_raises(ArgumentError) { dt.month = 13 }
assert_raise(ArgumentError) { dt.month = 0 }
assert_raise(ArgumentError) { dt.month = 13 }
assert_nothing_raised(ArgumentError) { dt.month = 7 }
assert_raises(ArgumentError) { dt.mon = 0 }
assert_raises(ArgumentError) { dt.mon = 13 }
assert_raise(ArgumentError) { dt.mon = 0 }
assert_raise(ArgumentError) { dt.mon = 13 }
assert_nothing_raised(ArgumentError) { dt.mon = 7 }
assert_raises(ArgumentError) { dt.day = 0 }
assert_raises(ArgumentError) { dt.day = 32 }
assert_raise(ArgumentError) { dt.day = 0 }
assert_raise(ArgumentError) { dt.day = 32 }
assert_nothing_raised(ArgumentError) { dt.day = 16 }
assert_raises(ArgumentError) { dt.hour = -1 }
assert_raises(ArgumentError) { dt.hour = 25 }
assert_raise(ArgumentError) { dt.hour = -1 }
assert_raise(ArgumentError) { dt.hour = 25 }
assert_nothing_raised(ArgumentError) { dt.hour = 12 }
assert_raises(ArgumentError) { dt.min = -1 }
assert_raises(ArgumentError) { dt.min = 60 }
assert_raise(ArgumentError) { dt.min = -1 }
assert_raise(ArgumentError) { dt.min = 60 }
assert_nothing_raised(ArgumentError) { dt.min = 30 }
assert_raises(ArgumentError) { dt.sec = -1 }
assert_raises(ArgumentError) { dt.sec = 60 }
assert_raise(ArgumentError) { dt.sec = -1 }
assert_raise(ArgumentError) { dt.sec = 60 }
assert_nothing_raised(ArgumentError) { dt.sec = 30 }
end

View file

@ -15,7 +15,7 @@ class Test_Features < Test::Unit::TestCase
XMLRPC::Config.module_eval {remove_const(:ENABLE_NIL_CREATE)}
XMLRPC::Config.const_set(:ENABLE_NIL_CREATE, false)
assert_raises(RuntimeError) { str = c.methodCall("test", *@params) }
assert_raise(RuntimeError) { str = c.methodCall("test", *@params) }
XMLRPC::Config.module_eval {remove_const(:ENABLE_NIL_CREATE)}
XMLRPC::Config.const_set(:ENABLE_NIL_CREATE, true)
@ -35,7 +35,7 @@ class Test_Features < Test::Unit::TestCase
XMLRPC::Config.module_eval {remove_const(:ENABLE_NIL_PARSER)}
XMLRPC::Config.const_set(:ENABLE_NIL_PARSER, false)
assert_raises(RuntimeError) { para = parser.parseMethodCall(str) }
assert_raise(RuntimeError) { para = parser.parseMethodCall(str) }
XMLRPC::Config.module_eval {remove_const(:ENABLE_NIL_PARSER)}
XMLRPC::Config.const_set(:ENABLE_NIL_PARSER, true)

View file

@ -68,7 +68,7 @@ class Test_Webrick < Test::Unit::TestCase
assert_equal 9, @s.call('test.add', 4, 5)
# fault exception
assert_raises(XMLRPC::FaultException) { @s.call('test.div', 1, 0) }
assert_raise(XMLRPC::FaultException) { @s.call('test.div', 1, 0) }
# fault exception via call2
ok, param = @s.call2('test.div', 1, 0)