* Added miniunit/autorun.rb as replacement for test/unit.rb's autorun.
* Fixed indentation of capture_io for ruby 1.9 warning. * assert_match escapes if passed string for pattern. * Removed disable_autorun method, added autorun.rb instead. [git-p4: depot-paths = "//src/minitest/dev/": change = 4503]
This commit is contained in:
parent
9886f97848
commit
207af7d81f
12
History.txt
12
History.txt
|
@ -1,3 +1,15 @@
|
|||
=== 1.3.2 / 2008-12-13
|
||||
|
||||
* 1 minor enhancement:
|
||||
|
||||
* Added miniunit/autorun.rb as replacement for test/unit.rb's autorun.
|
||||
|
||||
* 3 bug fixes:
|
||||
|
||||
* Fixed indentation of capture_io for ruby 1.9 warning.
|
||||
* assert_match escapes if passed string for pattern.
|
||||
* Removed disable_autorun method, added autorun.rb instead.
|
||||
|
||||
=== 1.3.1 / 2008-10-25
|
||||
|
||||
* 4 bug fixes:
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
require 'minitest/unit'
|
||||
|
||||
MiniTest::Unit.autorun
|
|
@ -112,7 +112,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
|
||||
|
||||
|
@ -185,20 +185,20 @@ module MiniTest
|
|||
assert caught, message(msg) { default }
|
||||
end
|
||||
|
||||
def capture_io
|
||||
require 'stringio'
|
||||
def capture_io
|
||||
require 'stringio'
|
||||
|
||||
orig_stdout, orig_stderr = $stdout, $stderr
|
||||
captured_stdout, captured_stderr = StringIO.new, StringIO.new
|
||||
$stdout, $stderr = captured_stdout, captured_stderr
|
||||
orig_stdout, orig_stderr = $stdout, $stderr
|
||||
captured_stdout, captured_stderr = StringIO.new, StringIO.new
|
||||
$stdout, $stderr = captured_stdout, captured_stderr
|
||||
|
||||
yield
|
||||
yield
|
||||
|
||||
return captured_stdout.string, captured_stderr.string
|
||||
ensure
|
||||
$stdout = orig_stdout
|
||||
$stderr = orig_stderr
|
||||
end
|
||||
return captured_stdout.string, captured_stderr.string
|
||||
ensure
|
||||
$stdout = orig_stdout
|
||||
$stderr = orig_stderr
|
||||
end
|
||||
|
||||
def exception_details e, msg
|
||||
"#{msg}\nClass: <#{e.class}>\nMessage: <#{e.message.inspect}>\n---Backtrace---\n#{MiniTest::filter_backtrace(e.backtrace).join("\n")}\n---------------"
|
||||
|
@ -307,7 +307,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
|
||||
|
@ -315,16 +315,13 @@ module MiniTest
|
|||
@@installed_at_exit ||= false
|
||||
@@out = $stdout
|
||||
|
||||
def self.disable_autorun
|
||||
@@installed_at_exit = true
|
||||
end
|
||||
|
||||
def self.autorun
|
||||
at_exit {
|
||||
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
|
||||
|
|
Loading…
Reference in New Issue