mirror of
https://github.com/ruby/ruby.git
synced 2025-09-15 16:44:01 +02:00
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
This commit is contained in:
parent
289d6bb30f
commit
9ef55da910
17 changed files with 68 additions and 95 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue