From 1ddbc7e70f82b1b9c95869b2c9584a9c52526df2 Mon Sep 17 00:00:00 2001 From: yugui Date: Sat, 13 Dec 2008 01:59:33 +0000 Subject: merges r20686 from trunk into ruby_1_9_1. Imported minitest 1.3.2 r4503. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_9_1@20711 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/minitest/autorun.rb | 9 +++++++++ lib/minitest/unit.rb | 12 +++++------- 2 files changed, 14 insertions(+), 7 deletions(-) create mode 100644 lib/minitest/autorun.rb (limited to 'lib') 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 -- cgit v1.2.3