mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Minitest::Unit.current_repeat_count
This method returns loop counter for multi-run (0 start).
This commit is contained in:
parent
151533e4bc
commit
20c1c24014
1 changed files with 8 additions and 4 deletions
|
@ -867,6 +867,10 @@ module MiniTest
|
||||||
##
|
##
|
||||||
# Runner for a given +type+ (eg, test vs bench).
|
# Runner for a given +type+ (eg, test vs bench).
|
||||||
|
|
||||||
|
def self.current_repeat_count
|
||||||
|
@@current_repeat_count
|
||||||
|
end
|
||||||
|
|
||||||
def _run_anything type
|
def _run_anything type
|
||||||
suites = TestCase.send "#{type}_suites"
|
suites = TestCase.send "#{type}_suites"
|
||||||
return if suites.empty?
|
return if suites.empty?
|
||||||
|
@ -880,7 +884,7 @@ module MiniTest
|
||||||
sync = output.respond_to? :"sync=" # stupid emacs
|
sync = output.respond_to? :"sync=" # stupid emacs
|
||||||
old_sync, output.sync = output.sync, true if sync
|
old_sync, output.sync = output.sync, true if sync
|
||||||
|
|
||||||
count = 0
|
@@current_repeat_count = 0
|
||||||
begin
|
begin
|
||||||
start = Time.now
|
start = Time.now
|
||||||
|
|
||||||
|
@ -891,15 +895,15 @@ module MiniTest
|
||||||
test_count += @test_count
|
test_count += @test_count
|
||||||
assertion_count += @assertion_count
|
assertion_count += @assertion_count
|
||||||
t = Time.now - start
|
t = Time.now - start
|
||||||
count += 1
|
@@current_repeat_count += 1
|
||||||
unless @repeat_count
|
unless @repeat_count
|
||||||
puts
|
puts
|
||||||
puts
|
puts
|
||||||
end
|
end
|
||||||
puts "Finished%s %ss in %.6fs, %.4f tests/s, %.4f assertions/s.\n" %
|
puts "Finished%s %ss in %.6fs, %.4f tests/s, %.4f assertions/s.\n" %
|
||||||
[(@repeat_count ? "(#{count}/#{@repeat_count}) " : ""), type,
|
[(@repeat_count ? "(#{@@current_repeat_count}/#{@repeat_count}) " : ""), type,
|
||||||
t, @test_count.fdiv(t), @assertion_count.fdiv(t)]
|
t, @test_count.fdiv(t), @assertion_count.fdiv(t)]
|
||||||
end while @repeat_count && count < @repeat_count &&
|
end while @repeat_count && @@current_repeat_count < @repeat_count &&
|
||||||
report.empty? && failures.zero? && errors.zero?
|
report.empty? && failures.zero? && errors.zero?
|
||||||
|
|
||||||
output.sync = old_sync if sync
|
output.sync = old_sync if sync
|
||||||
|
|
Loading…
Reference in a new issue