[前][次][番号順一覧][スレッド一覧]

ruby-changes:70901

From: Nobuyoshi <ko1@a...>
Date: Sun, 16 Jan 2022 21:35:36 +0900 (JST)
Subject: [ruby-changes:70901] 56b45e8c8e (master): Let testunit use omit or pend instead of skip

https://git.ruby-lang.org/ruby.git/commit/?id=56b45e8c8e

From 56b45e8c8e96210a2c17fde9408d46100f8d89cb Mon Sep 17 00:00:00 2001
From: Nobuyoshi Nakada <nobu@r...>
Date: Sun, 16 Jan 2022 16:33:34 +0900
Subject: Let testunit use omit or pend instead of skip

---
 tool/test/testunit/test4test_hideskip.rb |  8 ++++++--
 tool/test/testunit/test4test_sorting.rb  |  2 +-
 tool/test/testunit/test_hideskip.rb      |  4 ++--
 tool/test/testunit/test_minitest_unit.rb | 24 +++++++++++++++++++-----
 4 files changed, 28 insertions(+), 10 deletions(-)

diff --git a/tool/test/testunit/test4test_hideskip.rb b/tool/test/testunit/test4test_hideskip.rb
index 410bffc13cc..14f79a5743b 100644
--- a/tool/test/testunit/test4test_hideskip.rb
+++ b/tool/test/testunit/test4test_hideskip.rb
@@ -4,7 +4,11 @@ $LOAD_PATH.unshift "#{File.dirname(__FILE__)}/../../lib" https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test4test_hideskip.rb#L4
 require 'test/unit'
 
 class TestForTestHideSkip < Test::Unit::TestCase
-  def test_skip
-    skip "do nothing"
+  def test_omit
+    omit "do nothing"
+  end
+
+  def test_pend
+    pend "do nothing"
   end
 end
diff --git a/tool/test/testunit/test4test_sorting.rb b/tool/test/testunit/test4test_sorting.rb
index 698c875b796..f5a6866425f 100644
--- a/tool/test/testunit/test4test_sorting.rb
+++ b/tool/test/testunit/test4test_sorting.rb
@@ -5,7 +5,7 @@ require 'test/unit' https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test4test_sorting.rb#L5
 
 class TestForTestHideSkip < Test::Unit::TestCase
   def test_c
-    skip "do nothing"
+    omit "do nothing"
   end
 
   def test_b
diff --git a/tool/test/testunit/test_hideskip.rb b/tool/test/testunit/test_hideskip.rb
index 13d887189e4..e15947fe536 100644
--- a/tool/test/testunit/test_hideskip.rb
+++ b/tool/test/testunit/test_hideskip.rb
@@ -4,10 +4,10 @@ require 'test/unit' https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_hideskip.rb#L4
 class TestHideSkip < Test::Unit::TestCase
   def test_hideskip
     assert_not_match(/^ *1\) Skipped/, hideskip)
-    assert_match(/^ *1\) Skipped/, hideskip("--show-skip"))
+    assert_match(/^ *1\) Skipped.*^ *2\) Skipped/m, hideskip("--show-skip"))
     output = hideskip("--hide-skip")
     output.gsub!(/Successful MJIT finish\n/, '') if defined?(RubyVM::MJIT) && RubyVM::MJIT.enabled?
-    assert_match(/assertions\/s.\n+1 tests, 0 assertions, 0 failures, 0 errors, 1 skips/, output)
+    assert_match(/assertions\/s.\n+2 tests, 0 assertions, 0 failures, 0 errors, 2 skips/, output)
   end
 
   private
diff --git a/tool/test/testunit/test_minitest_unit.rb b/tool/test/testunit/test_minitest_unit.rb
index 5941392fa09..84b6cf688c7 100644
--- a/tool/test/testunit/test_minitest_unit.rb
+++ b/tool/test/testunit/test_minitest_unit.rb
@@ -171,7 +171,7 @@ class TestMiniTestUnit < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L171
   def test_passed_eh_teardown_skipped
     test_class = Class.new Test::Unit::TestCase do
       def teardown; assert true; end
-      def test_omg; skip "bork"; end
+      def test_omg; omit "bork"; end
     end
 
     test = test_class.new :test_omg
@@ -896,7 +896,7 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L896
         begin
           raise "blah"
         rescue
-          skip "skipped"
+          omit "skipped"
         end
       end
     end
@@ -1323,11 +1323,19 @@ class TestMiniTestUnitTestCase < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L1323
     end
   end
 
-  def test_skip
+  def test_omit
     @assertion_count = 0
 
     util_assert_triggered "haha!", Test::Unit::PendedError do
-      @tc.skip "haha!"
+      @tc.omit "haha!"
+    end
+  end
+
+  def test_pend
+    @assertion_count = 0
+
+    util_assert_triggered "haha!", Test::Unit::PendedError do
+      @tc.pend "haha!"
     end
   end
 
@@ -1467,7 +1475,13 @@ class TestMiniTestUnitRecording < MetaMetaMetaTestCase https://github.com/ruby/ruby/blob/trunk/tool/test/testunit/test_minitest_unit.rb#L1475
   def test_record_skip
     assert_run_record Test::Unit::PendedError do
       def test_method
-        skip "not yet"
+        omit "not yet"
+      end
+    end
+
+    assert_run_record Test::Unit::PendedError do
+      def test_method
+        pend "not yet"
       end
     end
   end
-- 
cgit v1.2.1


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]