diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-05-17 16:33:56 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2020-05-17 16:34:06 +0900 |
commit | 968d6df49f5f59eb2898d27399ad6d49b723216d (patch) | |
tree | 45ac36c433a0ff02c1c3e16ef49b5aec65208b00 /tool | |
parent | 2c3c6c96cfc31eb387c643990375e6e1d67b409d (diff) | |
download | ruby-968d6df49f5f59eb2898d27399ad6d49b723216d.tar.gz |
Added --test-order=nosort option
Run tests in the order given in the command line.
Diffstat (limited to 'tool')
-rw-r--r-- | tool/lib/minitest/unit.rb | 9 | ||||
-rw-r--r-- | tool/lib/test/unit.rb | 2 |
2 files changed, 8 insertions, 3 deletions
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 |