mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Replace MiniTest::Unit to Test::Unit::Runner
This commit is contained in:
parent
c18e953937
commit
8ec187c091
Notes:
git
2021-09-11 08:48:40 +09:00
6 changed files with 23 additions and 23 deletions
|
@ -271,7 +271,7 @@ module Test
|
|||
capture_stdout = true
|
||||
unless /mswin|mingw/ =~ RUBY_PLATFORM
|
||||
capture_stdout = false
|
||||
opt[:out] = MiniTest::Unit.output if defined?(MiniTest::Unit)
|
||||
opt[:out] = Test::Unit::Runner.output if defined?(Test::Unit::Runner)
|
||||
res_p, res_c = IO.pipe
|
||||
opt[:ios] = [res_c]
|
||||
end
|
||||
|
|
|
@ -112,7 +112,7 @@ class LeakChecker
|
|||
}
|
||||
unless fd_leaked.empty?
|
||||
unless @@try_lsof == false
|
||||
@@try_lsof |= system(*%W[lsof -a -d #{fd_leaked.minmax.uniq.join("-")} -p #$$], out: MiniTest::Unit.output)
|
||||
@@try_lsof |= system(*%W[lsof -a -d #{fd_leaked.minmax.uniq.join("-")} -p #$$], out: Test::Unit::Runner.output)
|
||||
end
|
||||
end
|
||||
h.each {|fd, list|
|
||||
|
@ -286,7 +286,7 @@ class LeakChecker
|
|||
end
|
||||
|
||||
def puts(*a)
|
||||
output = MiniTest::Unit.output
|
||||
output = Test::Unit::Runner.output
|
||||
if defined?(output.set_encoding)
|
||||
output.set_encoding(nil, nil)
|
||||
end
|
||||
|
|
|
@ -83,7 +83,7 @@ module Test
|
|||
private
|
||||
def setup_options(opts, options)
|
||||
opts.separator 'minitest options:'
|
||||
opts.version = MiniTest::Unit::VERSION
|
||||
opts.version = Test::Unit::Runner::VERSION
|
||||
|
||||
opts.on '-h', '--help', 'Display this help.' do
|
||||
puts opts
|
||||
|
@ -1196,14 +1196,14 @@ module Test
|
|||
# A simple hook allowing you to run a block of code after _all_ of
|
||||
# the tests are done. Eg:
|
||||
#
|
||||
# MiniTest::Unit.after_tests { p $debugging_info }
|
||||
# Test::Unit::Runner.after_tests { p $debugging_info }
|
||||
|
||||
def self.after_tests &block
|
||||
@@after_tests << block
|
||||
end
|
||||
|
||||
##
|
||||
# Registers MiniTest::Unit to run tests at process exit
|
||||
# Registers Test::Unit::Runner to run tests at process exit
|
||||
|
||||
def self.autorun
|
||||
at_exit {
|
||||
|
@ -1221,7 +1221,7 @@ module Test
|
|||
exit false if exit_code && exit_code != 0
|
||||
}
|
||||
|
||||
exit_code = MiniTest::Unit.new.run ARGV
|
||||
exit_code = Test::Unit::Runner.new.run ARGV
|
||||
} unless @@installed_at_exit
|
||||
@@installed_at_exit = true
|
||||
end
|
||||
|
@ -1234,7 +1234,7 @@ module Test
|
|||
end
|
||||
|
||||
##
|
||||
# Sets MiniTest::Unit to write output to +stream+. $stdout is the default
|
||||
# Sets Test::Unit::Runner to write output to +stream+. $stdout is the default
|
||||
# output
|
||||
|
||||
def self.output= stream
|
||||
|
@ -1242,16 +1242,16 @@ module Test
|
|||
end
|
||||
|
||||
##
|
||||
# Tells MiniTest::Unit to delegate to +runner+, an instance of a
|
||||
# MiniTest::Unit subclass, when MiniTest::Unit#run is called.
|
||||
# Tells Test::Unit::Runner to delegate to +runner+, an instance of a
|
||||
# Test::Unit::Runner subclass, when Test::Unit::Runner#run is called.
|
||||
|
||||
def self.runner= runner
|
||||
@@runner = runner
|
||||
end
|
||||
|
||||
##
|
||||
# Returns the MiniTest::Unit subclass instance that will be used
|
||||
# to run the tests. A MiniTest::Unit instance is the default
|
||||
# Returns the Test::Unit::Runner subclass instance that will be used
|
||||
# to run the tests. A Test::Unit::Runner instance is the default
|
||||
# runner.
|
||||
|
||||
def self.runner
|
||||
|
@ -1403,13 +1403,13 @@ module Test
|
|||
# Record the result of a single test. Makes it very easy to gather
|
||||
# information. Eg:
|
||||
#
|
||||
# class StatisticsRecorder < MiniTest::Unit
|
||||
# class StatisticsRecorder < Test::Unit::Runner
|
||||
# def record suite, method, assertions, time, error
|
||||
# # ... record the results somewhere ...
|
||||
# end
|
||||
# end
|
||||
#
|
||||
# MiniTest::Unit.runner = StatisticsRecorder.new
|
||||
# Test::Unit::Runner.runner = StatisticsRecorder.new
|
||||
#
|
||||
# NOTE: record might be sent more than once per test. It will be
|
||||
# sent once with the results from the test itself. If there is a
|
||||
|
@ -1476,7 +1476,7 @@ module Test
|
|||
|
||||
OptionParser.new do |opts|
|
||||
opts.banner = 'minitest options:'
|
||||
opts.version = MiniTest::Unit::VERSION
|
||||
opts.version = Test::Unit::Runner::VERSION
|
||||
|
||||
opts.on '-h', '--help', 'Display this help.' do
|
||||
puts opts
|
||||
|
@ -1589,7 +1589,7 @@ module Test
|
|||
|
||||
alias mini_run_suite _run_suite
|
||||
|
||||
# Overriding of MiniTest::Unit#puke
|
||||
# Overriding of Test::Unit::Runner#puke
|
||||
def puke klass, meth, e
|
||||
# TODO:
|
||||
# this overriding is for minitest feature that skip messages are
|
||||
|
|
|
@ -596,7 +596,7 @@ module Test
|
|||
# Takes a block and wraps it with the runner's shared mutex.
|
||||
|
||||
def synchronize
|
||||
MiniTest::Unit.runner.synchronize do
|
||||
Test::Unit::Runner.runner.synchronize do
|
||||
yield
|
||||
end
|
||||
end
|
||||
|
|
|
@ -34,10 +34,10 @@ module Test
|
|||
|
||||
def _run_suite(suite, type) # :nodoc:
|
||||
@partial_report = []
|
||||
orig_testout = MiniTest::Unit.output
|
||||
orig_testout = Test::Unit::Runner.output
|
||||
i,o = IO.pipe
|
||||
|
||||
MiniTest::Unit.output = o
|
||||
Test::Unit::Runner.output = o
|
||||
orig_stdin, orig_stdout = $stdin, $stdout
|
||||
|
||||
th = Thread.new do
|
||||
|
@ -58,7 +58,7 @@ module Test
|
|||
result = [nil,nil]
|
||||
end
|
||||
|
||||
MiniTest::Unit.output = orig_testout
|
||||
Test::Unit::Runner.output = orig_testout
|
||||
$stdin = orig_stdin
|
||||
$stdout = orig_stdout
|
||||
|
||||
|
@ -79,7 +79,7 @@ module Test
|
|||
_report "done", Marshal.dump(result)
|
||||
return result
|
||||
ensure
|
||||
MiniTest::Unit.output = orig_stdout
|
||||
Test::Unit::Runner.output = orig_stdout
|
||||
$stdin = orig_stdin if orig_stdin
|
||||
$stdout = orig_stdout if orig_stdout
|
||||
o.close if o && !o.closed?
|
||||
|
|
|
@ -111,7 +111,7 @@ module Test
|
|||
# end
|
||||
# end
|
||||
#
|
||||
# class MiniTest::Unit::TestCase
|
||||
# class Test::Unit::Runner::TestCase
|
||||
# include MyMinitestPlugin
|
||||
# end
|
||||
|
||||
|
@ -230,7 +230,7 @@ module Test
|
|||
|
||||
def io
|
||||
@__io__ = true
|
||||
MiniTest::Unit.output
|
||||
Test::Unit::Runner.output
|
||||
end
|
||||
|
||||
##
|
||||
|
|
Loading…
Reference in a new issue