ruby-changes:67881
From: Hiroshi <ko1@a...>
Date: Sat, 11 Sep 2021 08:48:27 +0900 (JST)
Subject: [ruby-changes:67881] 8ec187c091 (master): Replace MiniTest::Unit to Test::Unit::Runner
https://git.ruby-lang.org/ruby.git/commit/?id=8ec187c091 From 8ec187c091537aa5d25f19eee522aaec12bc7c26 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Wed, 8 Sep 2021 10:35:50 +0900 Subject: Replace MiniTest::Unit to Test::Unit::Runner --- tool/lib/core_assertions.rb | 2 +- tool/lib/leakchecker.rb | 4 ++-- tool/lib/test/unit.rb | 26 +++++++++++++------------- tool/lib/test/unit/assertions.rb | 2 +- tool/lib/test/unit/parallel.rb | 8 ++++---- tool/lib/test/unit/testcase.rb | 4 ++-- 6 files changed, 23 insertions(+), 23 deletions(-) diff --git a/tool/lib/core_assertions.rb b/tool/lib/core_assertions.rb index fd3c187..36ff2a0 100644 --- a/tool/lib/core_assertions.rb +++ b/tool/lib/core_assertions.rb @@ -271,7 +271,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/core_assertions.rb#L271 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 diff --git a/tool/lib/leakchecker.rb b/tool/lib/leakchecker.rb index 1d45a3a..052bea5 100644 --- a/tool/lib/leakchecker.rb +++ b/tool/lib/leakchecker.rb @@ -112,7 +112,7 @@ class LeakChecker https://github.com/ruby/ruby/blob/trunk/tool/lib/leakchecker.rb#L112 } 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 https://github.com/ruby/ruby/blob/trunk/tool/lib/leakchecker.rb#L286 end def puts(*a) - output = MiniTest::Unit.output + output = Test::Unit::Runner.output if defined?(output.set_encoding) output.set_encoding(nil, nil) end diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb index 3569111..6b9f385 100644 --- a/tool/lib/test/unit.rb +++ b/tool/lib/test/unit.rb @@ -83,7 +83,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit.rb#L83 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 https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit.rb#L1196 # 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 https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit.rb#L1221 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 https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit.rb#L1234 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 https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit.rb#L1242 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 https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit.rb#L1403 # 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 https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit.rb#L1476 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 https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit.rb#L1589 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 diff --git a/tool/lib/test/unit/assertions.rb b/tool/lib/test/unit/assertions.rb index 29ace55..711d8a6 100644 --- a/tool/lib/test/unit/assertions.rb +++ b/tool/lib/test/unit/assertions.rb @@ -596,7 +596,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit/assertions.rb#L596 # 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 diff --git a/tool/lib/test/unit/parallel.rb b/tool/lib/test/unit/parallel.rb index a223a9e..b0d8262 100644 --- a/tool/lib/test/unit/parallel.rb +++ b/tool/lib/test/unit/parallel.rb @@ -34,10 +34,10 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit/parallel.rb#L34 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 https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit/parallel.rb#L58 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 https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit/parallel.rb#L79 _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? diff --git a/tool/lib/test/unit/testcase.rb b/tool/lib/test/unit/testcase.rb index 6187780..bbba87f 100644 --- a/tool/lib/test/unit/testcase.rb +++ b/tool/lib/test/unit/testcase.rb @@ -111,7 +111,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit/testcase.rb#L111 # end # end # - # class MiniTest::Unit::TestCase + # class Test::Unit::Runner::TestCase # include MyMinitestPlugin # end @@ -230,7 +230,7 @@ module Test https://github.com/ruby/ruby/blob/trunk/tool/lib/test/unit/testcase.rb#L230 def io @__io__ = true - MiniTest::Unit.output + Test::Unit::Runner.output end ## -- cgit v1.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/