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

ruby-changes:39323

From: nobu <ko1@a...>
Date: Mon, 27 Jul 2015 16:28:55 +0900 (JST)
Subject: [ruby-changes:39323] nobu:r51404 (trunk): test/unit.rb: --test-order option

nobu	2015-07-27 16:28:36 +0900 (Mon, 27 Jul 2015)

  New Revision: 51404

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

  Log:
    test/unit.rb: --test-order option
    
    * test/lib/test/unit.rb (setup_options): add --test-order option
      to override the test order.

  Modified files:
    trunk/test/lib/test/unit.rb
Index: test/lib/test/unit.rb
===================================================================
--- test/lib/test/unit.rb	(revision 51403)
+++ test/lib/test/unit.rb	(revision 51404)
@@ -88,6 +88,10 @@ module Test https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L88
         opts.on '-n', '--name PATTERN', "Filter test method names on pattern: /REGEXP/ or STRING" do |a|
           options[:filter] = a
         end
+
+        opts.on '--test-order=random|alpha|sorted', [:random, :alpha, :sorted] do |a|
+          MiniTest::Unit::TestCase.test_order = a
+        end
       end
 
       def non_options(files, options)
@@ -981,6 +985,14 @@ module MiniTest # :nodoc: all https://github.com/ruby/ruby/blob/trunk/test/lib/test/unit.rb#L985
 end
 
 class MiniTest::Unit::TestCase # :nodoc: all
+  test_order = self.test_order
+  def self.test_order
+    @test_order || superclass.test_order
+  end
+  class << self
+    attr_writer :test_order
+  end
+  self.test_order = test_order
   undef run_test
   RUN_TEST_TRACE = "#{__FILE__}:#{__LINE__+3}:in `run_test'".freeze
   def run_test(name)

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

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