diff --git a/tool/lib/minitest/unit.rb b/tool/lib/minitest/unit.rb index 5d24d0e30d..707dcfbf4f 100644 --- a/tool/lib/minitest/unit.rb +++ b/tool/lib/minitest/unit.rb @@ -1404,11 +1404,14 @@ module MiniTest end def self.test_suites # :nodoc: + suites = @@test_suites.keys case self.test_order when :random - @@test_suites.keys.shuffle + suites.shuffle + when :nosort + suites else - @@test_suites.keys.sort_by { |ts| ts.name.to_s } + suites.sort_by { |ts| ts.name.to_s } end end @@ -1424,6 +1427,8 @@ module MiniTest methods.sort.sort_by { rand max } when :alpha, :sorted then methods.sort + when :nosort + methods else raise "Unknown test_order: #{self.test_order.inspect}" end diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb index a2ee464ff1..0cba377db2 100644 --- a/tool/lib/test/unit.rb +++ b/tool/lib/test/unit.rb @@ -102,7 +102,7 @@ module Test (options[:filter] ||= []) << a end - opts.on '--test-order=random|alpha|sorted', [:random, :alpha, :sorted] do |a| + opts.on '--test-order=random|alpha|sorted|nosort', [:random, :alpha, :sorted, :nosort] do |a| MiniTest::Unit::TestCase.test_order = a end end