From 00b4a3f9c4aaf5aa038a9530ec515e1718ae1c42 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 24 Sep 2008 17:44:39 +0000 Subject: * 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 --- test/dbm/test_dbm.rb | 4 +- test/drb/drbtest.rb | 16 ++--- test/drb/test_drb.rb | 14 ++--- test/fileutils/test_fileutils.rb | 36 +++++------ test/gdbm/test_gdbm.rb | 4 +- test/json/test_json.rb | 70 +++++++++++----------- test/json/test_json_addition.rb | 4 +- test/json/test_json_fixtures.rb | 2 +- test/json/test_json_generate.rb | 18 +++--- test/json/test_json_rails.rb | 2 +- test/json/test_json_unicode.rb | 2 +- test/logger/test_logger.rb | 2 +- test/net/http/test_httpheader.rb | 2 +- test/openssl/test_cipher.rb | 2 +- test/openssl/test_ec.rb | 2 +- test/openssl/test_ssl.rb | 18 +++--- test/openssl/test_x509cert.rb | 6 +- test/openssl/test_x509store.rb | 4 +- test/optparse/test_noarg.rb | 12 ++-- test/optparse/test_reqarg.rb | 6 +- test/readline/test_readline.rb | 6 +- test/readline/test_readline_history.rb | 14 ++--- test/rinda/test_rinda.rb | 18 +++--- test/ruby/marshaltestlib.rb | 22 +++---- test/ruby/test_beginendblock.rb | 4 +- test/ruby/test_call.rb | 4 +- test/ruby/test_clone.rb | 2 +- test/ruby/test_env.rb | 6 +- test/ruby/test_exception.rb | 4 +- test/ruby/test_iterator.rb | 18 +++--- test/ruby/test_lambda.rb | 24 ++++---- test/ruby/test_pack.rb | 10 ++-- test/ruby/test_readpartial.rb | 8 +-- test/ruby/test_signal.rb | 2 +- test/ruby/test_thread.rb | 4 +- test/ruby/test_variable.rb | 2 +- test/rubygems/test_gem_builder.rb | 2 +- test/rubygems/test_gem_command_manager.rb | 4 +- test/rubygems/test_gem_commands_install_command.rb | 10 ++-- test/rubygems/test_gem_install_update_options.rb | 2 +- test/rubygems/test_gem_installer.rb | 4 +- test/rubygems/test_gem_package_tar_header.rb | 8 +-- test/rubygems/test_gem_stream_ui.rb | 2 +- test/rubygems/test_gem_version.rb | 2 +- test/strscan/test_stringscanner.rb | 4 +- test/test_shellwords.rb | 6 +- test/testunit/util/test_observable.rb | 4 +- test/uri/test_ftp.rb | 2 +- test/uri/test_generic.rb | 24 ++++---- test/uri/test_http.rb | 2 +- test/uri/test_ldap.rb | 2 +- test/uri/test_mailto.rb | 4 +- test/webrick/test_httpauth.rb | 4 +- test/webrick/test_httprequest.rb | 8 +-- test/webrick/test_httputils.rb | 36 +++++------ test/webrick/test_utils.rb | 12 ++-- test/xmlrpc/test_datetime.rb | 46 +++++++------- test/xmlrpc/test_features.rb | 4 +- test/xmlrpc/test_webrick_server.rb | 2 +- 59 files changed, 284 insertions(+), 284 deletions(-) diff --git a/test/dbm/test_dbm.rb b/test/dbm/test_dbm.rb index 159ab43f35..dc02d30c76 100644 --- a/test/dbm/test_dbm.rb +++ b/test/dbm/test_dbm.rb @@ -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 diff --git a/test/drb/drbtest.rb b/test/drb/drbtest.rb index 143d856a1e..e06139a9d6 100644 --- a/test/drb/drbtest.rb +++ b/test/drb/drbtest.rb @@ -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 diff --git a/test/drb/test_drb.rb b/test/drb/test_drb.rb index 106e958d9a..57cf7175d7 100644 --- a/test/drb/test_drb.rb +++ b/test/drb/test_drb.rb @@ -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 diff --git a/test/fileutils/test_fileutils.rb b/test/fileutils/test_fileutils.rb index b4ddee0239..495a6273b2 100644 --- a/test/fileutils/test_fileutils.rb +++ b/test/fileutils/test_fileutils.rb @@ -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' } diff --git a/test/gdbm/test_gdbm.rb b/test/gdbm/test_gdbm.rb index 6033a7640b..8c86d4510d 100644 --- a/test/gdbm/test_gdbm.rb +++ b/test/gdbm/test_gdbm.rb @@ -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 diff --git a/test/json/test_json.rb b/test/json/test_json.rb index 2c706d52f1..8cb226702b 100755 --- a/test/json/test_json.rb +++ b/test/json/test_json.rb @@ -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 = < 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 diff --git a/test/json/test_json_addition.rb b/test/json/test_json_addition.rb index cf8a92ae10..95b6166261 100755 --- a/test/json/test_json_addition.rb +++ b/test/json/test_json_addition.rb @@ -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 diff --git a/test/json/test_json_fixtures.rb b/test/json/test_json_fixtures.rb index 33573cd300..6cc1bfc6fa 100755 --- a/test/json/test_json_fixtures.rb +++ b/test/json/test_json_fixtures.rb @@ -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 diff --git a/test/json/test_json_generate.rb b/test/json/test_json_generate.rb index b7e0bc22c6..8c55a409cd 100644 --- a/test/json/test_json_generate.rb +++ b/test/json/test_json_generate.rb @@ -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 diff --git a/test/json/test_json_rails.rb b/test/json/test_json_rails.rb index c0447ddaba..52dc29f388 100644 --- a/test/json/test_json_rails.rb +++ b/test/json/test_json_rails.rb @@ -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 diff --git a/test/json/test_json_unicode.rb b/test/json/test_json_unicode.rb index 862c6ea1e0..b8a37c8b8d 100755 --- a/test/json/test_json_unicode.rb +++ b/test/json/test_json_unicode.rb @@ -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 diff --git a/test/logger/test_logger.rb b/test/logger/test_logger.rb index 12728c608b..c7d553c413 100644 --- a/test/logger/test_logger.rb +++ b/test/logger/test_logger.rb @@ -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 # diff --git a/test/net/http/test_httpheader.rb b/test/net/http/test_httpheader.rb index 3ba1b217c0..379c9bd1ad 100644 --- a/test/net/http/test_httpheader.rb +++ b/test/net/http/test_httpheader.rb @@ -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 } diff --git a/test/openssl/test_cipher.rb b/test/openssl/test_cipher.rb index d671908165..cc21e818ed 100644 --- a/test/openssl/test_cipher.rb +++ b/test/openssl/test_cipher.rb @@ -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 diff --git a/test/openssl/test_ec.rb b/test/openssl/test_ec.rb index 671901ca36..66dbf54b4d 100644 --- a/test/openssl/test_ec.rb +++ b/test/openssl/test_ec.rb @@ -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 diff --git a/test/openssl/test_ssl.rb b/test/openssl/test_ssl.rb index 186d855633..44e79c9e24 100644 --- a/test/openssl/test_ssl.rb +++ b/test/openssl/test_ssl.rb @@ -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")) diff --git a/test/openssl/test_x509cert.rb b/test/openssl/test_x509cert.rb index a5a75ff1b6..c092ce5796 100644 --- a/test/openssl/test_x509cert.rb +++ b/test/openssl/test_x509cert.rb @@ -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) } diff --git a/test/openssl/test_x509store.rb b/test/openssl/test_x509store.rb index b0fe597262..fc7c35e3dd 100644 --- a/test/openssl/test_x509store.rb +++ b/test/openssl/test_x509store.rb @@ -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 diff --git a/test/optparse/test_noarg.rb b/test/optparse/test_noarg.rb index 28c469093d..329956a61a 100644 --- a/test/optparse/test_noarg.rb +++ b/test/optparse/test_noarg.rb @@ -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 diff --git a/test/optparse/test_reqarg.rb b/test/optparse/test_reqarg.rb index 0999e5e603..4ce9dd6292 100644 --- a/test/optparse/test_reqarg.rb +++ b/test/optparse/test_reqarg.rb @@ -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")}) diff --git a/test/readline/test_readline.rb b/test/readline/test_readline.rb index 071accf68b..36aadd92d7 100644 --- a/test/readline/test_readline.rb +++ b/test/readline/test_readline.rb @@ -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("> ") } diff --git a/test/readline/test_readline_history.rb b/test/readline/test_readline_history.rb index d80d432622..0b55c114f6 100644 --- a/test/readline/test_readline_history.rb +++ b/test/readline/test_readline_history.rb @@ -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=") 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 diff --git a/test/rinda/test_rinda.rb b/test/rinda/test_rinda.rb index 14d3c31499..84367aba67 100644 --- a/test/rinda/test_rinda.rb +++ b/test/rinda/test_rinda.rb @@ -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 diff --git a/test/ruby/marshaltestlib.rb b/test/ruby/marshaltestlib.rb index 0a70380d44..4486a78429 100644 --- a/test/ruby/marshaltestlib.rb +++ b/test/ruby/marshaltestlib.rb @@ -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 diff --git a/test/ruby/test_beginendblock.rb b/test/ruby/test_beginendblock.rb index 594596698b..463ebd94b6 100644 --- a/test/ruby/test_beginendblock.rb +++ b/test/ruby/test_beginendblock.rb @@ -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 diff --git a/test/ruby/test_call.rb b/test/ruby/test_call.rb index da7ee93c73..8f861d96a1 100644 --- a/test/ruby/test_call.rb +++ b/test/ruby/test_call.rb @@ -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)) diff --git a/test/ruby/test_clone.rb b/test/ruby/test_clone.rb index 43c0cffa1d..c5e2469d10 100644 --- a/test/ruby/test_clone.rb +++ b/test/ruby/test_clone.rb @@ -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 diff --git a/test/ruby/test_env.rb b/test/ruby/test_env.rb index 0ee702b222..f59fa14355 100644 --- a/test/ruby/test_env.rb +++ b/test/ruby/test_env.rb @@ -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 diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index 3300fcdd74..cba88f5c90 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -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 diff --git a/test/ruby/test_iterator.rb b/test/ruby/test_iterator.rb index f6ac645321..ca6022a4fb 100644 --- a/test/ruby/test_iterator.rb +++ b/test/ruby/test_iterator.rb @@ -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 diff --git a/test/ruby/test_lambda.rb b/test/ruby/test_lambda.rb index bb0861ab53..241042d2c7 100644 --- a/test/ruby/test_lambda.rb +++ b/test/ruby/test_lambda.rb @@ -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 diff --git a/test/ruby/test_pack.rb b/test/ruby/test_pack.rb index 30ffe13426..fee992efbc 100644 --- a/test/ruby/test_pack.rb +++ b/test/ruby/test_pack.rb @@ -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 diff --git a/test/ruby/test_readpartial.rb b/test/ruby/test_readpartial.rb index c4f9d193f2..fd601e7d33 100644 --- a/test/ruby/test_readpartial.rb +++ b/test/ruby/test_readpartial.rb @@ -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) } } } diff --git a/test/ruby/test_signal.rb b/test/ruby/test_signal.rb index 0bc2078c18..7d9acfdc12 100644 --- a/test/ruby/test_signal.rb +++ b/test/ruby/test_signal.rb @@ -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 } diff --git a/test/ruby/test_thread.rb b/test/ruby/test_thread.rb index 4332b0fe2e..97e58cd9ea 100644 --- a/test/ruby/test_thread.rb +++ b/test/ruby/test_thread.rb @@ -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 diff --git a/test/ruby/test_variable.rb b/test/ruby/test_variable.rb index 53cd151585..5a0c7800bb 100644 --- a/test/ruby/test_variable.rb +++ b/test/ruby/test_variable.rb @@ -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 diff --git a/test/rubygems/test_gem_builder.rb b/test/rubygems/test_gem_builder.rb index 31a0d71880..3463b4d403 100644 --- a/test/rubygems/test_gem_builder.rb +++ b/test/rubygems/test_gem_builder.rb @@ -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 diff --git a/test/rubygems/test_gem_command_manager.rb b/test/rubygems/test_gem_command_manager.rb index ee58e89844..59d3b5cb8e 100644 --- a/test/rubygems/test_gem_command_manager.rb +++ b/test/rubygems/test_gem_command_manager.rb @@ -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 diff --git a/test/rubygems/test_gem_commands_install_command.rb b/test/rubygems/test_gem_commands_install_command.rb index ef04072b93..e972429ce1 100644 --- a/test/rubygems/test_gem_commands_install_command.rb +++ b/test/rubygems/test_gem_commands_install_command.rb @@ -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 diff --git a/test/rubygems/test_gem_install_update_options.rb b/test/rubygems/test_gem_install_update_options.rb index 3638a0670a..9a017384a5 100644 --- a/test/rubygems/test_gem_install_update_options.rb +++ b/test/rubygems/test_gem_install_update_options.rb @@ -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 diff --git a/test/rubygems/test_gem_installer.rb b/test/rubygems/test_gem_installer.rb index eb9743dd42..e57461f53a 100644 --- a/test/rubygems/test_gem_installer.rb +++ b/test/rubygems/test_gem_installer.rb @@ -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 diff --git a/test/rubygems/test_gem_package_tar_header.rb b/test/rubygems/test_gem_package_tar_header.rb index 9b7708dca8..9158061cf6 100644 --- a/test/rubygems/test_gem_package_tar_header.rb +++ b/test/rubygems/test_gem_package_tar_header.rb @@ -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 diff --git a/test/rubygems/test_gem_stream_ui.rb b/test/rubygems/test_gem_stream_ui.rb index a8564ba94f..caf620ff00 100644 --- a/test/rubygems/test_gem_stream_ui.rb +++ b/test/rubygems/test_gem_stream_ui.rb @@ -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 diff --git a/test/rubygems/test_gem_version.rb b/test/rubygems/test_gem_version.rb index 8d10700490..5c04502d48 100644 --- a/test/rubygems/test_gem_version.rb +++ b/test/rubygems/test_gem_version.rb @@ -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 diff --git a/test/strscan/test_stringscanner.rb b/test/strscan/test_stringscanner.rb index ff1eb7a298..151e8928a4 100644 --- a/test/strscan/test_stringscanner.rb +++ b/test/strscan/test_stringscanner.rb @@ -31,8 +31,8 @@ class TestStringScanner < Test::Unit::TestCase def test_s_allocate s = StringScanner.allocate assert_equal '#', 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 '#', s.inspect.sub(/StringScanner_C/, 'StringScanner') assert_nothing_raised(UNINIT_ERROR) { s.eos? } diff --git a/test/test_shellwords.rb b/test/test_shellwords.rb index ddb2d870b0..e6ee3d6b4d 100644 --- a/test/test_shellwords.rb +++ b/test/test_shellwords.rb @@ -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 diff --git a/test/testunit/util/test_observable.rb b/test/testunit/util/test_observable.rb index 6cd10184f1..19e1db0180 100644 --- a/test/testunit/util/test_observable.rb +++ b/test/testunit/util/test_observable.rb @@ -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 diff --git a/test/uri/test_ftp.rb b/test/uri/test_ftp.rb index c27cf6165b..6311be81b7 100644 --- a/test/uri/test_ftp.rb +++ b/test/uri/test_ftp.rb @@ -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 diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb index e8024c8bf2..0d481c369a 100644 --- a/test/uri/test_generic.rb +++ b/test/uri/test_generic.rb @@ -121,8 +121,8 @@ class URI::TestGeneric < Test::Unit::TestCase # 7 # reported by Mr. Kubota - 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 diff --git a/test/uri/test_http.rb b/test/uri/test_http.rb index a6846141df..6c8e700b77 100644 --- a/test/uri/test_http.rb +++ b/test/uri/test_http.rb @@ -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 diff --git a/test/uri/test_ldap.rb b/test/uri/test_ldap.rb index 866b7d8066..0eaa113c94 100644 --- a/test/uri/test_ldap.rb +++ b/test/uri/test_ldap.rb @@ -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 diff --git a/test/uri/test_mailto.rb b/test/uri/test_mailto.rb index ba437904f8..38715fcc9c 100644 --- a/test/uri/test_mailto.rb +++ b/test/uri/test_mailto.rb @@ -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 diff --git a/test/webrick/test_httpauth.rb b/test/webrick/test_httpauth.rb index 75926b1624..427f839f35 100644 --- a/test/webrick/test_httpauth.rb +++ b/test/webrick/test_httpauth.rb @@ -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) diff --git a/test/webrick/test_httprequest.rb b/test/webrick/test_httprequest.rb index f49bd59384..92ad1e79ca 100644 --- a/test/webrick/test_httprequest.rb +++ b/test/webrick/test_httprequest.rb @@ -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 diff --git a/test/webrick/test_httputils.rb b/test/webrick/test_httputils.rb index 9d39ff53ab..ebe8a2b8a5 100644 --- a/test/webrick/test_httputils.rb +++ b/test/webrick/test_httputils.rb @@ -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 diff --git a/test/webrick/test_utils.rb b/test/webrick/test_utils.rb index ace4632547..e63e0ebbfd 100644 --- a/test/webrick/test_utils.rb +++ b/test/webrick/test_utils.rb @@ -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 } } diff --git a/test/xmlrpc/test_datetime.rb b/test/xmlrpc/test_datetime.rb index e38cea6f74..528e0805fc 100644 --- a/test/xmlrpc/test_datetime.rb +++ b/test/xmlrpc/test_datetime.rb @@ -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 diff --git a/test/xmlrpc/test_features.rb b/test/xmlrpc/test_features.rb index 96a6313202..377d539f26 100644 --- a/test/xmlrpc/test_features.rb +++ b/test/xmlrpc/test_features.rb @@ -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) diff --git a/test/xmlrpc/test_webrick_server.rb b/test/xmlrpc/test_webrick_server.rb index 4cd63cfa74..38cfe2f896 100644 --- a/test/xmlrpc/test_webrick_server.rb +++ b/test/xmlrpc/test_webrick_server.rb @@ -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) -- cgit v1.2.3