diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-02-27 10:49:14 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-02-28 17:44:23 +0900 |
commit | 28399e4e0f8036b03d7e626b0071de0f59ac7bc0 (patch) | |
tree | d6591721d6775f80331055dbe98e7890d0a1fd28 /tool/lib | |
parent | 9bede6e942e7726d320d734fead741672d060625 (diff) | |
download | ruby-28399e4e0f8036b03d7e626b0071de0f59ac7bc0.tar.gz |
respect --test-order=random
Now --test-order=random is simply ignored. This patch respect
this option.
Diffstat (limited to 'tool/lib')
-rw-r--r-- | tool/lib/minitest/unit.rb | 9 | ||||
-rw-r--r-- | tool/lib/test/unit.rb | 8 | ||||
-rw-r--r-- | tool/lib/test/unit/testcase.rb | 4 |
3 files changed, 15 insertions, 6 deletions
diff --git a/tool/lib/minitest/unit.rb b/tool/lib/minitest/unit.rb index f4e5e4ec8b..3d1b796fdf 100644 --- a/tool/lib/minitest/unit.rb +++ b/tool/lib/minitest/unit.rb @@ -1387,11 +1387,16 @@ module MiniTest end def self.test_order # :nodoc: - :random + :sorted end def self.test_suites # :nodoc: - @@test_suites.keys.sort_by { |ts| ts.name.to_s } + case self.test_order + when :random + @@test_suites.keys.shuffle + else + @@test_suites.keys.sort_by { |ts| ts.name.to_s } + end end def self.test_methods # :nodoc: diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb index ad053cffdd..130fcf07e1 100644 --- a/tool/lib/test/unit.rb +++ b/tool/lib/test/unit.rb @@ -474,6 +474,14 @@ module Test # Require needed thing for parallel running require 'timeout' @tasks = @files.dup # Array of filenames. + + case MiniTest::Unit::TestCase.test_order + when :random + @tasks.shuffle! + else + # sorted + end + @need_quit = false @dead_workers = [] # Array of dead workers. @warnings = [] diff --git a/tool/lib/test/unit/testcase.rb b/tool/lib/test/unit/testcase.rb index 58cfbcab99..68149a4880 100644 --- a/tool/lib/test/unit/testcase.rb +++ b/tool/lib/test/unit/testcase.rb @@ -18,10 +18,6 @@ module Test super runner end - def self.test_order - :sorted - end - def self.method_added(name) super return unless name.to_s.start_with?("test_") |