Issue #4657 has been updated by Shota Fukumori.

Status changed from Open to Closed

r31502 ????????????????????????

-q, --hide-skip???skip??????????表示????????????????????
----------------------------------------
Feature #4657: add option to hide skip messages on unit/test
http://redmine.ruby-lang.org/issues/4657

Author: Shota Fukumori
Status: Closed
Priority: Normal
Assignee: 
Category: lib
Target version: 


????test-all???Skip????????????skip?????????表示??????????????????????追????????????????????????

???????ruby-ja??以??????????????????????????????????
>nurse: ???????????????????????????????????test-all???skip?????test-all???????表示??????????????????????????
>unak: ?????????????????????????
>nurse: ?表示???????????????????????????????????
>unak: skip??表示??????????????????????????????


以??????????????????????????test/unit (test-all)???--hide-skip??????????追???????????
--hide-skip????????????????????????????Skipped??????????表示????????????????????

???????????Skip????尾???????????確?????????????????????????????????????????

?????:

$ make TESTS='--hide-skip date' test-all
./miniruby -I../../lib -I. -I.ext/common  ../../tool/runruby.rb --extout=.ext  -- "../../test/runner.rb" --ruby="./miniruby -I../../lib -I. -I.ext/common  ../../tool/runruby.rb --extout=.ext  --" --hide-skip date
Run options: "--ruby=./miniruby -I../../lib -I. -I.ext/common  ../../tool/runruby.rb --extout=.ext  --" --hide-skip

# Running tests:

..............................SSS....SSSSSSSSSSSSSSSS.SS........................................................................

Finished tests in 11.376260s, 11.2515 tests/s, 14151.3116 assertions/s.

128 tests, 160989 assertions, 0 failures, 0 errors, 21 skips




= patch below

diff --git lib/test/unit.rb lib/test/unit.rb
index 1f1bb09..e88309f 100644
--- lib/test/unit.rb
+++ lib/test/unit.rb
@@ -103,6 +103,10 @@ module Test
         opts.on '--ruby VAL', "Path to ruby; It'll have used at -j option" do |a|
           options[:ruby] = a.split(/ /).reject(&:empty?)
         end
+
+        opts.on '--hide-skip', 'Hide skipped tests' do
+          options[:hide_skip] = true
+        end
       end

       def non_options(files, options)
@@ -547,6 +551,7 @@ module Test
             end
           }
         end
+        report.reject!{|r| r.start_with? "Skipped:" } if @opts[:hide_skip]
         result
       end

diff --git test/testunit/test4test_hideskip.rb test/testunit/test4test_hideskip.rb
new file mode 100644
index 0000000..6fe3284
--- /dev/null
+++ test/testunit/test4test_hideskip.rb
@@ -0,0 +1,7 @@
+require 'test/unit'
+
+class TestForTestHideSkip < Test::Unit::TestCase
+  def test_skip
+    skip
+  end
+end
diff --git test/testunit/test_hideskip.rb test/testunit/test_hideskip.rb
new file mode 100644
index 0000000..967ecaf
--- /dev/null
+++ test/testunit/test_hideskip.rb
@@ -0,0 +1,20 @@
+require 'test/unit'
+
+class TestHideSkip < Test::Unit::TestCase
+  def test_hideskip
+    test_out, o = IO.pipe
+    spawn(*@options[:ruby], "#{File.dirname(__FILE__)}/test4test_hideskip.rb",
+          out: o, err: o)
+    o.close
+    assert_match(/assertions\/s.\n\n  1\) Skipped/,test_out.read)
+    test_out.close
+
+    test_out, o = IO.pipe
+    spawn(*@options[:ruby], "#{File.dirname(__FILE__)}/test4test_hideskip.rb",
+          "--hide-skip", out: o, err: o)
+    o.close
+    assert_match(/assertions\/s.\n\n1 tests, 0 assertions, 0 failures, 0 errors, 1 skips/,
+                 test_out.read)
+    test_out.close
+  end
+end


-- 
http://redmine.ruby-lang.org