summaryrefslogtreecommitdiff
path: root/lib/test
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-05 14:22:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-12-05 14:22:36 +0000
commit33f0b0ae0b0eeb3bd510cd8525dd0e6076566437 (patch)
tree4b69d89a9a3447af135a21e1b3b6d3c6431112c0 /lib/test
parent1ed39b739237bffd9c78e696c09462ce67017b95 (diff)
* lib/test/unit/assertions.rb (Test::Unit::Assertions::assert_raises,
Test::Unit::Assertions::assert_nothing_raised): use the last argument as message unless non-class object. * test/testunit/test_assertions.rb (test_assert_raises): test for multiple exception list. [ruby-core:01891] * test/testunit/test_assertions.rb (test_assert_nothing_raised): test for non-exception classes. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@5122 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/test')
-rw-r--r--lib/test/unit/assertions.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb
index 02126badca..3076b7fd02 100644
--- a/lib/test/unit/assertions.rb
+++ b/lib/test/unit/assertions.rb
@@ -60,13 +60,13 @@ EOT
public
def assert_raises(*args)
_wrap_assertion do
- if Class === args.last and Exception >= args.last
+ if Class === args.last
message = ""
else
message = args.pop
end
args.each do |klass|
- assert(Exception >= klass, "Should expect a class of exception")
+ assert(Exception >= klass, "Should expect a class of exception, #{klass}")
end
expected = args.size == 1 ? args.first : args
actual_exception = nil
@@ -182,13 +182,13 @@ EOT
public
def assert_nothing_raised(*args)
_wrap_assertion do
- if Class === args.last and Exception >= args.last
+ if Class === args.last
message = ""
else
message = args.pop
end
args.each do |klass|
- assert(Exception >= klass, "Should expect a class of exception")
+ assert(Exception >= klass, "Should expect a class of exception, #{klass}")
end
begin
yield