summaryrefslogtreecommitdiff
path: root/tool
diff options
context:
space:
mode:
authorNobuyoshi Nakada <nobu@ruby-lang.org>2021-06-24 18:49:49 +0900
committerNobuyoshi Nakada <nobu@ruby-lang.org>2021-06-24 18:52:35 +0900
commite1c3cb9357aa952633757556fccb4e7e14dfa091 (patch)
tree2670d953a601ee66ba5e30e98073f9b21c028816 /tool
parent627aafac866b8eef562e9772998d0967f26b1c20 (diff)
downloadruby-e1c3cb9357aa952633757556fccb4e7e14dfa091.tar.gz
test: imply random test order by --seed option
Diffstat (limited to 'tool')
-rw-r--r--tool/lib/test/unit.rb5
1 files changed, 4 insertions, 1 deletions
diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb
index 7862f094dc..391c065ec1 100644
--- a/tool/lib/test/unit.rb
+++ b/tool/lib/test/unit.rb
@@ -62,13 +62,16 @@ module Test
non_options(args, options)
@run_options = orig_args
+ order = options[:test_order]
if seed = options[:seed]
+ order ||= :random
srand(seed)
else
seed = options[:seed] = srand % 100_000
srand(seed)
orig_args.unshift "--seed=#{seed}"
end
+ MiniTest::Unit::TestCase.test_order = order if order
@help = "\n" + orig_args.map { |s|
" " + (s =~ /[\s|&<>$()]/ ? s.inspect : s)
@@ -100,7 +103,7 @@ module Test
end
opts.on '--test-order=random|alpha|sorted|nosort', [:random, :alpha, :sorted, :nosort] do |a|
- MiniTest::Unit::TestCase.test_order = a
+ options[:test_order] = a
end
end