From 642b3a260bda7e4b8380bcc797efce547879295e Mon Sep 17 00:00:00 2001 From: nobu Date: Sat, 24 Dec 2016 00:50:59 +0000 Subject: test/unit.rb: --repeat-count option * test/lib/test/unit.rb (Test::Unit::RepeatOption): --repeat-count option to repeat COUNT times while success. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57167 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- test/lib/test/unit.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'test/lib/test/unit.rb') diff --git a/test/lib/test/unit.rb b/test/lib/test/unit.rb index 1a5957bfc1..f0bd26f32f 100644 --- a/test/lib/test/unit.rb +++ b/test/lib/test/unit.rb @@ -853,6 +853,22 @@ module Test end end + module RepeatOption # :nodoc: all + def setup_options(parser, options) + super + options[:repeat_count] = nil + parser.separator "repeat options:" + parser.on '--repeat-count=NUM', "Number of times to repeat", Integer do |n| + options[:repeat_count] = n + end + end + + def _run_anything(type) + @repeat_count = @options[:repeat_count] + super + end + end + module ExcludesOption # :nodoc: all class ExcludedMethods < Struct.new(:excludes) def exclude(name, reason) @@ -922,6 +938,7 @@ module Test include Test::Unit::Parallel include Test::Unit::Skipping include Test::Unit::GlobOption + include Test::Unit::RepeatOption include Test::Unit::LoadPathOption include Test::Unit::GCStressOption include Test::Unit::ExcludesOption -- cgit v1.2.3