diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-30 15:26:34 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2010-04-30 15:26:34 +0000 |
commit | 11caac16638cce5b5346e80246045897c33b0732 (patch) | |
tree | e7725721798a961007388c48828421ea97fa3665 /lib | |
parent | b36b3067f0ed837e787753604e248085abde433c (diff) | |
download | ruby-11caac16638cce5b5346e80246045897c33b0732.tar.gz |
* lib/test/unit/assertions.rb (Test::Unit::Assertions#assert):
assertion message must be String or Proc. suggested by caleb
clausen at [ruby-core:29884].
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@27568 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r-- | lib/test/unit/assertions.rb | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb index 821faf5803..9a6d643623 100644 --- a/lib/test/unit/assertions.rb +++ b/lib/test/unit/assertions.rb @@ -10,6 +10,15 @@ module Test obj.pretty_inspect.chomp end + def assert(test, msg = (nomsg = true; nil)) + unless nomsg or msg.instance_of?(String) or msg.instance_of?(Proc) or + (bt = caller).shift.rindex(MiniTest::MINI_DIR, 0) + bt = MiniTest.filter_backtrace(bt) + raise ArgumentError, "assertion message must be String or Proc, but #{msg.class} was given.", bt + end + super + end + def assert_raise(*args, &b) assert_raises(*args, &b) end |