Skip to content

Commit 04925c6

Browse files
committed
Add --keep-repeating option
It directs the program to continue repeating the tests the specified number of times, even if any tests fail along the way.
1 parent d60144a commit 04925c6

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

tool/lib/test/unit.rb

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1299,10 +1299,15 @@ def setup_options(parser, options)
12991299
parser.on '--repeat-count=NUM', "Number of times to repeat", Integer do |n|
13001300
options[:repeat_count] = n
13011301
end
1302+
options[:keep_repeating] = false
1303+
parser.on '--[no-]keep-repeating', "Keep repeating even failed" do |n|
1304+
options[:keep_repeating] = true
1305+
end
13021306
end
13031307

13041308
def _run_anything(type)
13051309
@repeat_count = @options[:repeat_count]
1310+
@keep_repeating = @options[:keep_repeating]
13061311
super
13071312
end
13081313
end
@@ -1624,7 +1629,7 @@ def _run_anything type
16241629
[(@repeat_count ? "(#{@@current_repeat_count}/#{@repeat_count}) " : ""), type,
16251630
t, @test_count.fdiv(t), @assertion_count.fdiv(t)]
16261631
end while @repeat_count && @@current_repeat_count < @repeat_count &&
1627-
report.empty? && failures.zero? && errors.zero?
1632+
(@keep_repeating || report.empty? && failures.zero? && errors.zero?)
16281633

16291634
output.sync = old_sync if sync
16301635

0 commit comments

Comments
 (0)