From ac6024f5221862e628d1ba201cbc422a672a9dc8 Mon Sep 17 00:00:00 2001 From: ryan Date: Sat, 13 Dec 2008 00:22:31 +0000 Subject: Imported minitest 1.3.2 r4503. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20686 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 6 ++++++ lib/minitest/autorun.rb | 9 +++++++++ lib/minitest/unit.rb | 12 +++++------- test/minitest/test_mini_test.rb | 4 ++-- 4 files changed, 22 insertions(+), 9 deletions(-) create mode 100644 lib/minitest/autorun.rb diff --git a/ChangeLog b/ChangeLog index c0e89d23a4..fd1d31348d 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +Sat Dec 13 09:17:33 2008 Ryan Davis + + * lib/minitest/*.rb: Imported minitest 1.3.2 r4503. + * test/minitest/test_mini_test.rb: ditto. + * lib/miniunit/autorun.rb: added (as part of r4503). + Sat Dec 13 08:35:14 2008 Tadayoshi Funaba * complex.c (nucomp_canonicalization): renamed. 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 diff --git a/test/minitest/test_mini_test.rb b/test/minitest/test_mini_test.rb index 2f30232074..d6493faf8e 100644 --- a/test/minitest/test_mini_test.rb +++ b/test/minitest/test_mini_test.rb @@ -69,9 +69,9 @@ class TestMiniTest < MiniTest::Unit::TestCase end def test_filter_backtrace_all_unit - bt = (["./lib/mini/test.rb:165:in `__send__'"] + + bt = (["#{MINITEST_BASE_DIR}/test.rb:165:in `__send__'"] + BT_MIDDLE + - ["./lib/mini/test.rb:29"]) + ["#{MINITEST_BASE_DIR}/test.rb:29"]) ex = bt.clone fu = MiniTest::filter_backtrace(bt) assert_equal ex, fu -- cgit v1.2.3