ruby-changes:67888
From: Hiroshi <ko1@a...>
Date: Sat, 11 Sep 2021 08:48:28 +0900 (JST)
Subject: [ruby-changes:67888] d5e94bf5db (master): Replace MiniTest to Test
https://git.ruby-lang.org/ruby.git/commit/?id=d5e94bf5db From d5e94bf5db899b5a54b37f10f39250df4ebef6a8 Mon Sep 17 00:00:00 2001 From: Hiroshi SHIBATA <hsbt@r...> Date: Thu, 9 Sep 2021 14:13:13 +0900 Subject: Replace MiniTest to Test --- tool/test/testunit/metametameta.rb | 16 ++-- tool/test/testunit/test_minitest_unit.rb | 126 +++++++++++++++---------------- 2 files changed, 71 insertions(+), 71 deletions(-) diff --git a/tool/test/testunit/metametameta.rb b/tool/test/testunit/metametameta.rb index dbc422f..d570106 100644 --- a/tool/test/testunit/metametameta.rb +++ b/tool/test/testunit/metametameta.rb @@ -4,13 +4,13 @@ https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/metametameta.rb#L4 require 'tempfile' require 'stringio' -class MiniTest::Unit::TestCase +class Test::Unit::TestCase def clean s s.gsub(/^ {6}/, '') end end -class MetaMetaMetaTestCase < MiniTest::Unit::TestCase +class MetaMetaMetaTestCase < Test::Unit::TestCase def assert_report expected, flags = %w[--seed 42] header = clean <<-EOM Run options: #{flags.map { |s| s =~ /\|/ ? s.inspect : s }.join " "} @@ -44,10 +44,10 @@ class MetaMetaMetaTestCase < MiniTest::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/metametameta.rb#L44 def setup super srand 42 - MiniTest::Unit::TestCase.reset - @tu = MiniTest::Unit.new + Test::Unit::TestCase.reset + @tu = Test::Unit.new - MiniTest::Unit.runner = nil # protect the outer runner from the inner tests + Test::Unit.runner = nil # protect the outer runner from the inner tests end def teardown @@ -57,13 +57,13 @@ class MetaMetaMetaTestCase < MiniTest::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/metametameta.rb#L57 def with_output synchronize do begin - save = MiniTest::Unit.output + save = Test::Unit.output @output = StringIO.new("") - MiniTest::Unit.output = @output + Test::Unit.output = @output yield ensure - MiniTest::Unit.output = save + Test::Unit.output = save end end end diff --git a/tool/test/testunit/test_minitest_unit.rb b/tool/test/testunit/test_minitest_unit.rb index 5476cf9..465ae14 100644 --- a/tool/test/testunit/test_minitest_unit.rb +++ b/tool/test/testunit/test_minitest_unit.rb @@ -19,7 +19,7 @@ class TestMiniTestUnit < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L19 "#{MINITEST_BASE_DIR}/test.rb:106:in `run'"] def test_class_puke_with_assertion_failed - exception = MiniTest::Assertion.new "Oh no!" + exception = Test::Assertion.new "Oh no!" exception.set_backtrace ["unhappy"] assert_equal 'F', @tu.puke('SomeClass', 'method_name', exception) assert_equal 1, @tu.failures @@ -39,7 +39,7 @@ class TestMiniTestUnit < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L39 ex_location = util_expand_bt(["test/test_some_class.rb:615"]).first - exception = MiniTest::Assertion.new "Oh no!" + exception = Test::Assertion.new "Oh no!" exception.set_backtrace bt assert_equal 'F', @tu.puke('TestSomeClass', 'test_method_name', exception) assert_equal 1, @tu.failures @@ -62,7 +62,7 @@ class TestMiniTestUnit < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L62 ex_location = util_expand_bt(["test/test_some_class.rb:615"]).first - exception = MiniTest::Assertion.new "Oh no!" + exception = Test::Assertion.new "Oh no!" exception.set_backtrace bt assert_equal 'F', @tu.puke('TestSomeClass', 'test_method_name', exception) assert_equal 1, @tu.failures @@ -72,8 +72,8 @@ class TestMiniTestUnit < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L72 def test_class_puke_with_failure_and_flunk_in_backtrace exception = begin - MiniTest::Unit::TestCase.new('fake tc').flunk - rescue MiniTest::Assertion => failure + Test::Unit::TestCase.new('fake tc').flunk + rescue Test::Assertion => failure failure end assert_equal 'F', @tu.puke('SomeClass', 'method_name', exception) @@ -95,7 +95,7 @@ class TestMiniTestUnit < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L95 ex_location = util_expand_bt(["test/test_some_class.rb:615"]).first - exception = MiniTest::Assertion.new "Oh no!" + exception = Test::Assertion.new "Oh no!" exception.set_backtrace bt assert_equal 'F', @tu.puke('TestSomeClass', 'test_method_name', exception) assert_equal 1, @tu.failures @@ -125,7 +125,7 @@ class TestMiniTestUnit < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L125 "test/test_autotest.rb:62:in `test_add_exception'"] ex = util_expand_bt ex - fu = MiniTest::filter_backtrace(bt) + fu = Test::filter_backtrace(bt) assert_equal ex, fu end @@ -135,7 +135,7 @@ class TestMiniTestUnit < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L135 BT_MIDDLE + ["#{MINITEST_BASE_DIR}/test.rb:29"]) ex = bt.clone - fu = MiniTest::filter_backtrace(bt) + fu = Test::filter_backtrace(bt) assert_equal ex, fu end @@ -148,17 +148,17 @@ class TestMiniTestUnit < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L148 bt = util_expand_bt bt ex = ["-e:1"] - fu = MiniTest::filter_backtrace bt + fu = Test::filter_backtrace bt assert_equal ex, fu end def test_default_runner_is_minitest_unit - assert_instance_of MiniTest::Unit, MiniTest::Unit.runner + assert_instance_of Test::Unit, Test::Unit.runner end def test_passed_eh_teardown_good - test_class = Class.new MiniTest::Unit::TestCase do + test_class = Class.new Test::Unit::TestCase do def teardown; assert true; end def test_omg; assert true; end end @@ -169,7 +169,7 @@ class TestMiniTestUnit < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L169 end def test_passed_eh_teardown_skipped - test_class = Class.new MiniTest::Unit::TestCase do + test_class = Class.new Test::Unit::TestCase do def teardown; assert true; end def test_omg; skip "bork"; end end @@ -180,7 +180,7 @@ class TestMiniTestUnit < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L180 end def test_passed_eh_teardown_flunked - test_class = Class.new MiniTest::Unit::TestCase do + test_class = Class.new Test::Unit::TestCase do def teardown; flunk; end def test_omg; assert true; end end @@ -223,7 +223,7 @@ class TestMiniTestUnitInherited < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L223 def test_inherited_hook_plays_nice_with_others with_overridden_include do assert_throws :inherited_hook do - Class.new MiniTest::Unit::TestCase + Class.new Test::Unit::TestCase end end end @@ -235,14 +235,14 @@ class TestMiniTestRunner < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L235 def test_class_test_suites @assertion_count = 0 - tc = Class.new(MiniTest::Unit::TestCase) + tc = Class.new(Test::Unit::TestCase) - assert_equal 1, MiniTest::Unit::TestCase.test_suites.size - assert_equal [tc], MiniTest::Unit::TestCase.test_suites + assert_equal 1, Test::Unit::TestCase.test_suites.size + assert_equal [tc], Test::Unit::TestCase.test_suites end def test_run_test - Class.new MiniTest::Unit::TestCase do + Class.new Test::Unit::TestCase do attr_reader :foo def run_test name @@ -268,7 +268,7 @@ class TestMiniTestRunner < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L268 end def test_run_error - Class.new MiniTest::Unit::TestCase do + Class.new Test::Unit::TestCase do def test_something assert true end @@ -295,7 +295,7 @@ class TestMiniTestRunner < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L295 end def test_run_error_teardown - Class.new MiniTest::Unit::TestCase do + Class.new Test::Unit::TestCase do def test_something assert true end @@ -322,7 +322,7 @@ class TestMiniTestRunner < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L322 end def test_run_failing - Class.new MiniTest::Unit::TestCase do + Class.new Test::Unit::TestCase do def test_something assert true end @@ -348,7 +348,7 @@ class TestMiniTestRunner < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L348 end def test_run_failing_filtered - Class.new MiniTest::Unit::TestCase do + Class.new Test::Unit::TestCase do def test_something assert true end @@ -372,14 +372,14 @@ class TestMiniTestRunner < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L372 def assert_filtering name, expected, a = false args = %W[--name #{name} --seed 42] - alpha = Class.new MiniTest::Unit::TestCase do + alpha = Class.new Test::Unit::TestCase do define_method :test_something do assert a end end Object.const_set(:Alpha, alpha) - beta = Class.new MiniTest::Unit::TestCase do + beta = Class.new Test::Unit::Tes (... truncated) -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/