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.
This commit is contained in:
Nobuyoshi Nakada 2025-06-15 22:15:10 +09:00
parent d60144a490
commit 04925c6608
No known key found for this signature in database
GPG key ID: 3582D74E1FEE4465

View file

@ -1299,10 +1299,15 @@ module Test
parser.on '--repeat-count=NUM', "Number of times to repeat", Integer do |n|
options[:repeat_count] = n
end
options[:keep_repeating] = false
parser.on '--[no-]keep-repeating', "Keep repeating even failed" do |n|
options[:keep_repeating] = true
end
end
def _run_anything(type)
@repeat_count = @options[:repeat_count]
@keep_repeating = @options[:keep_repeating]
super
end
end
@ -1624,7 +1629,7 @@ module Test
[(@repeat_count ? "(#{@@current_repeat_count}/#{@repeat_count}) " : ""), type,
t, @test_count.fdiv(t), @assertion_count.fdiv(t)]
end while @repeat_count && @@current_repeat_count < @repeat_count &&
report.empty? && failures.zero? && errors.zero?
(@keep_repeating || report.empty? && failures.zero? && errors.zero?)
output.sync = old_sync if sync