diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-09 08:43:12 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-10-09 08:43:12 +0000 |
commit | 9ef55da91006a19dc4fb612c735b335175b3259b (patch) | |
tree | d1b5676b11b6cf64709f040c2c1b4aba60da02fe /test/ruby/test_exception.rb | |
parent | 289d6bb30f4c2fffa2437436030c889f10522e72 (diff) | |
download | ruby-9ef55da91006a19dc4fb612c735b335175b3259b.tar.gz |
test/unit/assertions.rb: return exception
* lib/test/unit/assertions.rb (assert_raise_with_message): return
raised exception same as assert_raise.
* test/ruby, test/-ext-: use assert_raise_with_message.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43212 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/ruby/test_exception.rb')
-rw-r--r-- | test/ruby/test_exception.rb | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/test/ruby/test_exception.rb b/test/ruby/test_exception.rb index b7b41db1cd..95db1308e7 100644 --- a/test/ruby/test_exception.rb +++ b/test/ruby/test_exception.rb @@ -28,7 +28,7 @@ class TestException < Test::Unit::TestCase def test_exception_in_rescue string = "this must be handled no.3" - e = assert_raise(RuntimeError) do + assert_raise_with_message(RuntimeError, string) do begin raise "exception in rescue clause" rescue @@ -36,12 +36,11 @@ class TestException < Test::Unit::TestCase end assert(false) end - assert_equal(string, e.message) end def test_exception_in_ensure string = "exception in ensure clause" - e = assert_raise(RuntimeError) do + assert_raise_with_message(RuntimeError, string) do begin raise "this must be handled no.4" ensure @@ -51,7 +50,6 @@ class TestException < Test::Unit::TestCase end assert(false) end - assert_equal(string, e.message) end def test_exception_ensure @@ -333,8 +331,10 @@ end.join bug3237 = '[ruby-core:29948]' str = "\u2600" id = :"\u2604" - e = assert_raise(NoMethodError) {str.__send__(id)} - assert_equal("undefined method `#{id}' for #{str.inspect}:String", e.message, bug3237) + msg = "undefined method `#{id}' for #{str.inspect}:String" + assert_raise_with_message(NoMethodError, msg, bug3237) do + str.__send__(id) + end end def test_errno |