summaryrefslogtreecommitdiff
path: root/lib/minitest/unit.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-05 23:24:58 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-09-05 23:24:58 +0000
commita3980eb2b6a88d4e95477f1e7cd29e9776a8396a (patch)
tree8ae50e804921443d963603832a8ac09768f62e57 /lib/minitest/unit.rb
parent8ee2226068bca03aba3dade555ccce3d64e4397a (diff)
Imported minitest 3.4.0 (r7762)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@36914 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib/minitest/unit.rb')
-rw-r--r--lib/minitest/unit.rb12
1 files changed, 8 insertions, 4 deletions
diff --git a/lib/minitest/unit.rb b/lib/minitest/unit.rb
index ed9c4fc721..ab16d1891f 100644
--- a/lib/minitest/unit.rb
+++ b/lib/minitest/unit.rb
@@ -311,7 +311,8 @@ module MiniTest
##
# Fails if stdout or stderr do not output the expected results.
# Pass in nil if you don't care about that streams output. Pass in
- # "" if you require it to be silent.
+ # "" if you require it to be silent. Pass in a regexp if you want
+ # to pattern match.
#
# See also: #assert_silent
@@ -320,8 +321,11 @@ module MiniTest
yield
end
- y = assert_equal stderr, err, "In stderr" if stderr
- x = assert_equal stdout, out, "In stdout" if stdout
+ err_msg = Regexp === stderr ? :assert_match : :assert_equal if stderr
+ out_msg = Regexp === stdout ? :assert_match : :assert_equal if stdout
+
+ y = send err_msg, stderr, err, "In stderr" if err_msg
+ x = send out_msg, stdout, out, "In stdout" if out_msg
(!stdout || x) && (!stderr || y)
end
@@ -655,7 +659,7 @@ module MiniTest
end
class Unit # :nodoc:
- VERSION = "3.3.0" # :nodoc:
+ VERSION = "3.4.0" # :nodoc:
attr_accessor :report, :failures, :errors, :skips # :nodoc:
attr_accessor :test_count, :assertion_count # :nodoc: