summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-13 00:22:31 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-12-13 00:22:31 +0000
commitac6024f5221862e628d1ba201cbc422a672a9dc8 (patch)
tree37b34aeea5faaf5ff7400bd6b8da9668371ff4cf /lib
parent0e0c53a09246b4058db69430e3701e7dee0b198a (diff)
Imported minitest 1.3.2 r4503.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'lib')
-rw-r--r--lib/minitest/autorun.rb9
-rw-r--r--lib/minitest/unit.rb12
2 files changed, 14 insertions, 7 deletions
diff --git a/lib/minitest/autorun.rb b/lib/minitest/autorun.rb
new file mode 100644
index 0000000000..a9f9c67166
--- /dev/null
+++ b/lib/minitest/autorun.rb
@@ -0,0 +1,9 @@
+############################################################
+# This file is imported from a different project.
+# DO NOT make modifications in this repo.
+# File a patch instead and assign it to Ryan Davis
+############################################################
+
+require 'minitest/unit'
+
+MiniTest::Unit.autorun
diff --git a/lib/minitest/unit.rb b/lib/minitest/unit.rb
index df6394a8eb..77176240c5 100644
--- a/lib/minitest/unit.rb
+++ b/lib/minitest/unit.rb
@@ -118,7 +118,7 @@ module MiniTest
def assert_match exp, act, msg = nil
msg = message(msg) { "Expected #{mu_pp(act)} to match #{mu_pp(exp)}" }
assert_respond_to act, :"=~"
- (exp = /#{exp}/) if String === exp && String === act
+ (exp = /#{Regexp.escape(exp)}/) if String === exp && String === act
assert act =~ exp, msg
end
@@ -313,7 +313,7 @@ module MiniTest
end
class Unit
- VERSION = "1.3.1"
+ VERSION = "1.3.2"
attr_accessor :report, :failures, :errors, :skips
attr_accessor :test_count, :assertion_count
@@ -321,16 +321,14 @@ module MiniTest
@@installed_at_exit ||= false
@@out = $stdout
- def self.disable_autorun
- @@installed_at_exit = true
- end
-
def self.autorun
at_exit {
+p $!
+ return if $! # don't run if there was an exception
exit_code = MiniTest::Unit.new.run(ARGV)
exit false if exit_code && exit_code != 0
} unless @@installed_at_exit
- disable_autorun
+ @@installed_at_exit = true
end
def self.output= stream