diff options
-rw-r--r-- | lib/test/unit/assertions.rb | 8 | ||||
-rw-r--r-- | test/mkmf/base.rb | 9 |
2 files changed, 9 insertions, 8 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 diff --git a/test/mkmf/base.rb b/test/mkmf/base.rb index 7df1e8961f..f4f00ed534 100644 --- a/test/mkmf/base.rb +++ b/test/mkmf/base.rb @@ -10,9 +10,6 @@ $extout_prefix = "$(extout)$(target_prefix)/" class TestMkmf < Test::Unit::TestCase MKMFLOG = proc {File.read("mkmf.log") rescue ""} - class << MKMFLOG - alias to_s call - end class Capture attr_accessor :origin @@ -54,11 +51,7 @@ class TestMkmf < Test::Unit::TestCase attr_reader :stdout def mkmflog(msg) - log = proc {MKMFLOG[] << msg} - class << log - alias to_s call - end - log + proc {MKMFLOG[] << msg} end def setup |