1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

Added --test-order=nosort option

Run tests in the order given in the command line.
This commit is contained in:
Nobuyoshi Nakada 2020-05-17 16:33:56 +09:00
parent 2c3c6c96cf
commit 968d6df49f
No known key found for this signature in database
GPG key ID: 7CD2805BFA3770C6
2 changed files with 8 additions and 3 deletions

View file

@ -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

View file

@ -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