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

ruby-changes:17572

From: tenderlove <ko1@a...>
Date: Sun, 24 Oct 2010 12:11:31 +0900 (JST)
Subject: [ruby-changes:17572] Ruby:r29577 (trunk): * lib/test/unit.rb: make test/unit play nicely with the rake test

tenderlove	2010-10-24 12:11:20 +0900 (Sun, 24 Oct 2010)

  New Revision: 29577

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

  Log:
    * lib/test/unit.rb: make test/unit play nicely with the rake test
      loader. [ruby-core:32864]

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

Index: ChangeLog
===================================================================
--- ChangeLog	(revision 29576)
+++ ChangeLog	(revision 29577)
@@ -1,3 +1,8 @@
+Sun Oct 24 12:08:54 2010  Aaron Patterson <aaron@t...>
+
+	* lib/test/unit.rb: make test/unit play nicely with the rake test
+	  loader. [ruby-core:32864]
+
 Sun Oct 24 00:25:13 2010  Nobuyoshi Nakada  <nobu@r...>
 
 	* test/ruby/test_rubyoptions.rb (test_segv_test): follow up the
Index: lib/test/unit.rb
===================================================================
--- lib/test/unit.rb	(revision 29576)
+++ lib/test/unit.rb	(revision 29577)
@@ -70,17 +70,6 @@
       end
 
       def non_options(files, options)
-        files.each {|f|
-          d = File.dirname(path = File.expand_path(f))
-          unless $:.include? d
-            $: << d
-          end
-          begin
-            require path
-          rescue LoadError
-            puts "#{f}: #{$!}"
-          end
-        }
       end
     end
 
@@ -133,35 +122,47 @@
       end
     end
 
+    module RequireFiles
+      def non_options(files, options)
+        super
+        files.each {|f|
+          d = File.dirname(path = File.expand_path(f))
+          unless $:.include? d
+            $: << d
+          end
+          begin
+            require path
+          rescue LoadError
+            puts "#{f}: #{$!}"
+          end
+        }
+      end
+    end
+
     def self.new(*args, &block)
+      Mini.class_eval do
+        include Test::Unit::RequireFiles
+      end
       Mini.new(*args, &block)
     end
 
     class Mini < MiniTest::Unit
       include Test::Unit::GlobOption
       include Test::Unit::LoadPathOption
+      include Test::Unit::RunCount
+      include Test::Unit::Options
+
+      class << self; undef autorun; end
+      def self.autorun
+        at_exit {
+          Test::Unit::RunCount.run_once {
+          exit(Test::Unit::Mini.new.run(ARGV) || true)
+        }
+        } unless @@installed_at_exit
+        @@installed_at_exit = true
+      end
     end
   end
 end
 
-class MiniTest::Unit
-  def self.new(*args, &block)
-    obj = allocate
-      .extend(Test::Unit::RunCount)
-      .extend(Test::Unit::Options)
-    obj.__send__(:initialize, *args, &block)
-    obj
-  end
-
-  class << self; undef autorun; end
-  def self.autorun
-    at_exit {
-      Test::Unit::RunCount.run_once {
-        exit(Test::Unit::Mini.new.run(ARGV) || true)
-      }
-    } unless @@installed_at_exit
-    @@installed_at_exit = true
-  end
-end
-
-MiniTest::Unit.autorun
+Test::Unit::Mini.autorun

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

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