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

ruby-changes:21156

From: sorah <ko1@a...>
Date: Tue, 6 Sep 2011 21:20:27 +0900 (JST)
Subject: [ruby-changes:21156] sorah:r33205 (trunk): * lib/test/unit.rb (_run_suites): Now reports are written the

sorah	2011-09-06 21:20:17 +0900 (Tue, 06 Sep 2011)

  New Revision: 33205

  http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=33205

  Log:
    * lib/test/unit.rb (_run_suites): Now reports are written the
      following order: Skip, Failure, Error. [Feature #5282]
    
    * test_sorting.rb: test for above.
    
    * test4test_sorting.rb: Ditto.
    
    * lib/test/unit.rb (run): Put RUBY_DESCIPTION before quitting.
      [Feature #5282]

  Added files:
    trunk/test/testunit/test4test_sorting.rb
    trunk/test/testunit/test_sorting.rb
  Modified files:
    trunk/ChangeLog
    trunk/lib/test/unit.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 33204)
+++ ChangeLog	(revision 33205)
@@ -1,3 +1,15 @@
+Tue Sep  6 21:06:49 2011  Shota Fukumori  <sorah@t...>
+
+	* lib/test/unit.rb (_run_suites): Now reports are written the
+	  following order: Skip, Failure, Error. [Feature #5282]
+
+	* test_sorting.rb: test for above.
+
+	* test4test_sorting.rb: Ditto.
+
+	* lib/test/unit.rb (run): Put RUBY_DESCIPTION before quitting.
+	  [Feature #5282]
+
 Tue Sep  6 21:13:47 2011  Masaya Tarui  <tarui@r...>
 
 	* win32/Makefile.sub (INSNS): change command line option -Ks to -Ku
Index: lib/test/unit.rb
===================================================================
--- lib/test/unit.rb	(revision 33204)
+++ lib/test/unit.rb	(revision 33205)
@@ -570,6 +570,8 @@
           }
         end
         report.reject!{|r| r.start_with? "Skipped:" } if @options[:hide_skip]
+        report.sort_by!{|r| r.start_with?("Skipped:") ? 0 : \
+                           (r.start_with?("Failure:") ? 1 : 2) }
         result
       end
 
@@ -599,6 +601,12 @@
         raise @interrupt if @interrupt
         result
       end
+
+      def run(*args)
+        result = super
+        puts "\nruby -v: #{RUBY_DESCRIPTION}"
+        result
+      end
     end
 
     class AutoRunner
Index: test/testunit/test_sorting.rb
===================================================================
--- test/testunit/test_sorting.rb	(revision 0)
+++ test/testunit/test_sorting.rb	(revision 33205)
@@ -0,0 +1,17 @@
+require 'test/unit'
+
+class TestTestUnitSorting < Test::Unit::TestCase
+  def test_sorting
+    test_out, o = IO.pipe
+    spawn(*@options[:ruby], "#{File.dirname(__FILE__)}/test4test_sorting.rb",
+          out: o, err: o)
+    o.close
+    result = test_out.read
+
+    assert_match(/^  1\) Skipped:/, result)
+    assert_match(/^  2\) Failure:/, result)
+    assert_match(/^  3\) Error:/,   result)
+
+    test_out.close
+  end
+end
Index: test/testunit/test4test_sorting.rb
===================================================================
--- test/testunit/test4test_sorting.rb	(revision 0)
+++ test/testunit/test4test_sorting.rb	(revision 33205)
@@ -0,0 +1,15 @@
+require 'test/unit'
+
+class TestForTestHideSkip < Test::Unit::TestCase
+  def test_c
+    skip "do nothing"
+  end
+
+  def test_b
+    assert_equal true, false
+  end
+
+  def test_a
+    raise
+  end
+end

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

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