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

ruby-changes:19852

From: ryan <ko1@a...>
Date: Thu, 2 Jun 2011 07:34:20 +0900 (JST)
Subject: [ruby-changes:19852] ryan:r31899 (trunk): Imported minitest 2.2.2 (r6281)

ryan	2011-06-02 07:34:09 +0900 (Thu, 02 Jun 2011)

  New Revision: 31899

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

  Log:
    Imported minitest 2.2.2 (r6281)

  Modified files:
    trunk/ChangeLog
    trunk/lib/minitest/unit.rb
    trunk/lib/test/unit.rb
    trunk/test/minitest/test_minitest_unit.rb

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 31898)
+++ ChangeLog	(revision 31899)
@@ -27,9 +27,7 @@
 
 Wed Jun  1 14:07:57 2011  Ryan Davis  <ryand-ruby@z...>
 
-	* lib/minitest/*: MOSTLY Imported minitest 2.2.1 (r6277)... One
-	  feature wouldn't run and I don't know how to fix it. I need
-	  sora_h's help to get it running happy with test/unit.
+	* lib/minitest/*: Imported minitest 2.2.2 (r6281)
 	* test/minitest/*: ditto
 
 Wed Jun  1 12:35:50 2011  Ryan Davis  <ryand-ruby@z...>
Index: lib/test/unit.rb
===================================================================
--- lib/test/unit.rb	(revision 31898)
+++ lib/test/unit.rb	(revision 31899)
@@ -595,6 +595,7 @@
           yield self if block_given?
           files
         end
+        Runner.runner = @runner
         @options = @runner.option_parser
         @argv = argv
       end
Index: lib/minitest/unit.rb
===================================================================
--- lib/minitest/unit.rb	(revision 31898)
+++ lib/minitest/unit.rb	(revision 31899)
@@ -121,10 +121,11 @@
 
       Tempfile.open("expect") do |a|
         a.puts expect
-        a.rewind
+        a.flush
+
         Tempfile.open("butwas") do |b|
           b.puts butwas
-          b.rewind
+          b.flush
 
           result = `#{MiniTest::Assertions.diff} #{a.path} #{b.path}`
           result.sub!(/^\-\-\- .+/, "--- expected")
@@ -216,7 +217,7 @@
     # See also: MiniTest::Assertions.diff
 
     def assert_equal exp, act, msg = nil
-      msg = message(msg) { diff exp, act }
+      msg = message(msg, "") { diff exp, act }
       assert(exp == act, msg)
     end
 
@@ -464,10 +465,10 @@
     ##
     # Returns a proc that will output +msg+ along with the default message.
 
-    def message msg = nil, &default
+    def message msg = nil, ending = ".", &default
       proc {
         custom_message = "#{msg}.\n" unless msg.nil? or msg.to_s.empty?
-        "#{custom_message}#{default.call}."
+        "#{custom_message}#{default.call}#{ending}"
       }
     end
 
@@ -619,7 +620,7 @@
   end
 
   class Unit
-    VERSION = "2.2.1" # :nodoc:
+    VERSION = "2.2.2" # :nodoc:
 
     attr_accessor :report, :failures, :errors, :skips # :nodoc:
     attr_accessor :test_count, :assertion_count       # :nodoc:
@@ -691,6 +692,23 @@
     end
 
     ##
+    # Tells MiniTest::Unit to delegate to +runner+, an instance of a
+    # MiniTest::Unit subclass, when MiniTest::Unit#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
+    # runner.
+
+    def self.runner
+      @@runner ||= self.new
+    end
+
+    ##
     # Return all plugins' run methods (methods that start with "run_").
 
     def self.plugins
@@ -860,9 +878,16 @@
     end
 
     ##
+    # Begins the full test run. Delegates to +runner+'s #_run method.
+
+    def run args = []
+      self.class.runner._run(args)
+    end
+
+    ##
     # Top level driver, controls all output and filtering.
 
-    def run args = []
+    def _run args = []
       self.options = process_args args
 
       puts "Run options: #{help}"
Index: test/minitest/test_minitest_unit.rb
===================================================================
--- test/minitest/test_minitest_unit.rb	(revision 31898)
+++ test/minitest/test_minitest_unit.rb	(revision 31899)
@@ -51,7 +51,7 @@
 
   def teardown
     MiniTest::Unit.output = $stdout
-    # HACK for ruby-trunk: MiniTest::Unit.runner = nil
+    MiniTest::Unit.runner = nil
     Object.send :remove_const, :ATestCase if defined? ATestCase
   end
 
@@ -392,13 +392,10 @@
   end
 
   def test_default_runner_is_minitest_unit
-    skip "ruby-trunk won't run with runner code :("
-
     assert_instance_of MiniTest::Unit, MiniTest::Unit.runner
   end
 
   def test_run_with_other_runner
-    skip "ruby-trunk won't run with runner code :("
 
     runner = Class.new(MiniTest::Unit) do
       # Run once before each suite
@@ -542,7 +539,7 @@
            @@ -1 +1 @@
            -#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"a\">
            +#<#<Class:0xXXXXXX>:0xXXXXXX @name=\"b\">
-           .".gsub(/^ +/, "")
+           ".gsub(/^ +/, "")
 
     util_assert_triggered msg do
       @tc.assert_equal o1, o2
@@ -555,7 +552,7 @@
 
     msg = "No visible difference.
            You should look at your implementation of Object#==.
-           #<Object:0xXXXXXX>.".gsub(/^ +/, "")
+           #<Object:0xXXXXXX>".gsub(/^ +/, "")
 
     util_assert_triggered msg do
       @tc.assert_equal o1, o2
@@ -568,7 +565,7 @@
            @@ -1 +1 @@
            -\"hahahahahahahahahahahahahahahahahahahaha\"
            +\"blahblahblahblahblahblahblahblahblahblah\"
-           .".gsub(/^ +/, "")
+           ".gsub(/^ +/, "")
 
     util_assert_triggered msg do
       o1 = "haha" * 10
@@ -581,7 +578,7 @@
   def test_assert_equal_different_long_invisible
     msg = "No visible difference.
            You should look at your implementation of String#==.
-           \"blahblahblahblahblahblahblahblahblahblah\".".gsub(/^ +/, "")
+           \"blahblahblahblahblahblahblahblahblahblah\"".gsub(/^ +/, "")
 
     util_assert_triggered msg do
       o1 = "blah" * 10
@@ -600,7 +597,7 @@
            @@ -1 +1 @@
            -\"hahahahahahahahahahahahahahahahahahahaha\"
            +\"blahblahblahblahblahblahblahblahblahblah\"
-           .".gsub(/^ +/, "")
+           ".gsub(/^ +/, "")
 
     util_assert_triggered msg do
       o1 = "haha" * 10
@@ -622,7 +619,7 @@
   end
 
   def test_assert_equal_different_short_multiline
-    msg = "--- expected\n+++ actual\n@@ -1,2 +1,2 @@\n \"a\n-b\"\n+c\"\n."
+    msg = "--- expected\n+++ actual\n@@ -1,2 +1,2 @@\n \"a\n-b\"\n+c\"\n"
     util_assert_triggered msg do
       @tc.assert_equal "a\nb", "a\nc"
     end
@@ -1292,7 +1289,7 @@
   end
 
   def util_msg exp, act, msg = nil
-    s = "Expected: #{exp.inspect}\n  Actual: #{act.inspect}."
+    s = "Expected: #{exp.inspect}\n  Actual: #{act.inspect}"
     s = "#{msg}.\n#{s}" if msg
     s
   end

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

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