diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-08 07:02:37 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-03-08 07:02:37 +0000 |
commit | 3d881966322458abe94cfb409b1606ceaaad49d7 (patch) | |
tree | bdc9710522b0affa3edd90471556a9c4af3b47ff /lib/test/unit | |
parent | 4a3970c2118e2c4a4558431886dde02cd7ad5b7e (diff) | |
download | ruby-3d881966322458abe94cfb409b1606ceaaad49d7.tar.gz |
assertions.rb: allow proc
* lib/test/unit/assertions.rb (Test::Unit::Assertions#message):
convert msg by call if it is a proc, as well as assert.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@39638 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/test/unit')
-rw-r--r-- | lib/test/unit/assertions.rb | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/test/unit/assertions.rb b/lib/test/unit/assertions.rb index 39a3c85600..f810d5a714 100644 --- a/lib/test/unit/assertions.rb +++ b/lib/test/unit/assertions.rb @@ -319,6 +319,14 @@ EOT template &&= template.chomp template.gsub(/\G((?:[^\\]|\\.)*?)(\\)?\?/) { $1 + ($2 ? "?" : mu_pp(arguments.shift)) } end + + def message(msg = nil, *args, &default) + if Proc === msg + super(nil, *args) {"#{msg.call}#{default.call if default}"} + else + super + end + end end end end |