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
|
capture_stdout = true
|
||||||
unless /mswin|mingw/ =~ RUBY_PLATFORM
|
unless /mswin|mingw/ =~ RUBY_PLATFORM
|
||||||
capture_stdout = false
|
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
|
res_p, res_c = IO.pipe
|
||||||
opt[:ios] = [res_c]
|
opt[:ios] = [res_c]
|
||||||
end
|
end
|
||||||
|
|
|
@ -112,7 +112,7 @@ class LeakChecker
|
||||||
}
|
}
|
||||||
unless fd_leaked.empty?
|
unless fd_leaked.empty?
|
||||||
unless @@try_lsof == false
|
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
|
||||||
end
|
end
|
||||||
h.each {|fd, list|
|
h.each {|fd, list|
|
||||||
|
@ -286,7 +286,7 @@ class LeakChecker
|
||||||
end
|
end
|
||||||
|
|
||||||
def puts(*a)
|
def puts(*a)
|
||||||
output = MiniTest::Unit.output
|
output = Test::Unit::Runner.output
|
||||||
if defined?(output.set_encoding)
|
if defined?(output.set_encoding)
|
||||||
output.set_encoding(nil, nil)
|
output.set_encoding(nil, nil)
|
||||||
end
|
end
|
||||||
|
|
|
@ -83,7 +83,7 @@ module Test
|
||||||
private
|
private
|
||||||
def setup_options(opts, options)
|
def setup_options(opts, options)
|
||||||
opts.separator 'minitest options:'
|
opts.separator 'minitest options:'
|
||||||
opts.version = MiniTest::Unit::VERSION
|
opts.version = Test::Unit::Runner::VERSION
|
||||||
|
|
||||||
opts.on '-h', '--help', 'Display this help.' do
|
opts.on '-h', '--help', 'Display this help.' do
|
||||||
puts opts
|
puts opts
|
||||||
|
@ -1196,14 +1196,14 @@ module Test
|
||||||
# A simple hook allowing you to run a block of code after _all_ of
|
# A simple hook allowing you to run a block of code after _all_ of
|
||||||
# the tests are done. Eg:
|
# 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
|
def self.after_tests &block
|
||||||
@@after_tests << block
|
@@after_tests << block
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Registers MiniTest::Unit to run tests at process exit
|
# Registers Test::Unit::Runner to run tests at process exit
|
||||||
|
|
||||||
def self.autorun
|
def self.autorun
|
||||||
at_exit {
|
at_exit {
|
||||||
|
@ -1221,7 +1221,7 @@ module Test
|
||||||
exit false if exit_code && exit_code != 0
|
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
|
} unless @@installed_at_exit
|
||||||
@@installed_at_exit = true
|
@@installed_at_exit = true
|
||||||
end
|
end
|
||||||
|
@ -1234,7 +1234,7 @@ module Test
|
||||||
end
|
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
|
# output
|
||||||
|
|
||||||
def self.output= stream
|
def self.output= stream
|
||||||
|
@ -1242,16 +1242,16 @@ module Test
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Tells MiniTest::Unit to delegate to +runner+, an instance of a
|
# Tells Test::Unit::Runner to delegate to +runner+, an instance of a
|
||||||
# MiniTest::Unit subclass, when MiniTest::Unit#run is called.
|
# Test::Unit::Runner subclass, when Test::Unit::Runner#run is called.
|
||||||
|
|
||||||
def self.runner= runner
|
def self.runner= runner
|
||||||
@@runner = runner
|
@@runner = runner
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
# Returns the MiniTest::Unit subclass instance that will be used
|
# Returns the Test::Unit::Runner subclass instance that will be used
|
||||||
# to run the tests. A MiniTest::Unit instance is the default
|
# to run the tests. A Test::Unit::Runner instance is the default
|
||||||
# runner.
|
# runner.
|
||||||
|
|
||||||
def self.runner
|
def self.runner
|
||||||
|
@ -1403,13 +1403,13 @@ module Test
|
||||||
# Record the result of a single test. Makes it very easy to gather
|
# Record the result of a single test. Makes it very easy to gather
|
||||||
# information. Eg:
|
# information. Eg:
|
||||||
#
|
#
|
||||||
# class StatisticsRecorder < MiniTest::Unit
|
# class StatisticsRecorder < Test::Unit::Runner
|
||||||
# def record suite, method, assertions, time, error
|
# def record suite, method, assertions, time, error
|
||||||
# # ... record the results somewhere ...
|
# # ... record the results somewhere ...
|
||||||
# end
|
# end
|
||||||
# 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
|
# 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
|
# sent once with the results from the test itself. If there is a
|
||||||
|
@ -1476,7 +1476,7 @@ module Test
|
||||||
|
|
||||||
OptionParser.new do |opts|
|
OptionParser.new do |opts|
|
||||||
opts.banner = 'minitest options:'
|
opts.banner = 'minitest options:'
|
||||||
opts.version = MiniTest::Unit::VERSION
|
opts.version = Test::Unit::Runner::VERSION
|
||||||
|
|
||||||
opts.on '-h', '--help', 'Display this help.' do
|
opts.on '-h', '--help', 'Display this help.' do
|
||||||
puts opts
|
puts opts
|
||||||
|
@ -1589,7 +1589,7 @@ module Test
|
||||||
|
|
||||||
alias mini_run_suite _run_suite
|
alias mini_run_suite _run_suite
|
||||||
|
|
||||||
# Overriding of MiniTest::Unit#puke
|
# Overriding of Test::Unit::Runner#puke
|
||||||
def puke klass, meth, e
|
def puke klass, meth, e
|
||||||
# TODO:
|
# TODO:
|
||||||
# this overriding is for minitest feature that skip messages are
|
# 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.
|
# Takes a block and wraps it with the runner's shared mutex.
|
||||||
|
|
||||||
def synchronize
|
def synchronize
|
||||||
MiniTest::Unit.runner.synchronize do
|
Test::Unit::Runner.runner.synchronize do
|
||||||
yield
|
yield
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,10 +34,10 @@ module Test
|
||||||
|
|
||||||
def _run_suite(suite, type) # :nodoc:
|
def _run_suite(suite, type) # :nodoc:
|
||||||
@partial_report = []
|
@partial_report = []
|
||||||
orig_testout = MiniTest::Unit.output
|
orig_testout = Test::Unit::Runner.output
|
||||||
i,o = IO.pipe
|
i,o = IO.pipe
|
||||||
|
|
||||||
MiniTest::Unit.output = o
|
Test::Unit::Runner.output = o
|
||||||
orig_stdin, orig_stdout = $stdin, $stdout
|
orig_stdin, orig_stdout = $stdin, $stdout
|
||||||
|
|
||||||
th = Thread.new do
|
th = Thread.new do
|
||||||
|
@ -58,7 +58,7 @@ module Test
|
||||||
result = [nil,nil]
|
result = [nil,nil]
|
||||||
end
|
end
|
||||||
|
|
||||||
MiniTest::Unit.output = orig_testout
|
Test::Unit::Runner.output = orig_testout
|
||||||
$stdin = orig_stdin
|
$stdin = orig_stdin
|
||||||
$stdout = orig_stdout
|
$stdout = orig_stdout
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ module Test
|
||||||
_report "done", Marshal.dump(result)
|
_report "done", Marshal.dump(result)
|
||||||
return result
|
return result
|
||||||
ensure
|
ensure
|
||||||
MiniTest::Unit.output = orig_stdout
|
Test::Unit::Runner.output = orig_stdout
|
||||||
$stdin = orig_stdin if orig_stdin
|
$stdin = orig_stdin if orig_stdin
|
||||||
$stdout = orig_stdout if orig_stdout
|
$stdout = orig_stdout if orig_stdout
|
||||||
o.close if o && !o.closed?
|
o.close if o && !o.closed?
|
||||||
|
|
|
@ -111,7 +111,7 @@ module Test
|
||||||
# end
|
# end
|
||||||
# end
|
# end
|
||||||
#
|
#
|
||||||
# class MiniTest::Unit::TestCase
|
# class Test::Unit::Runner::TestCase
|
||||||
# include MyMinitestPlugin
|
# include MyMinitestPlugin
|
||||||
# end
|
# end
|
||||||
|
|
||||||
|
@ -230,7 +230,7 @@ module Test
|
||||||
|
|
||||||
def io
|
def io
|
||||||
@__io__ = true
|
@__io__ = true
|
||||||
MiniTest::Unit.output
|
Test::Unit::Runner.output
|
||||||
end
|
end
|
||||||
|
|
||||||
##
|
##
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue