ruby-changes:59852
From: Koichi <ko1@a...>
Date: Tue, 28 Jan 2020 18:22:03 +0900 (JST)
Subject: [ruby-changes:59852] 20c1c24014 (master): Minitest::Unit.current_repeat_count
https://git.ruby-lang.org/ruby.git/commit/?id=20c1c24014 From 20c1c240145b7db66014020e233b23d12574efae Mon Sep 17 00:00:00 2001 From: Koichi Sasada <ko1@a...> Date: Tue, 28 Jan 2020 18:13:58 +0900 Subject: Minitest::Unit.current_repeat_count This method returns loop counter for multi-run (0 start). diff --git a/tool/lib/minitest/unit.rb b/tool/lib/minitest/unit.rb index 8ac0f14..8569b2c 100644 --- a/tool/lib/minitest/unit.rb +++ b/tool/lib/minitest/unit.rb @@ -867,6 +867,10 @@ module MiniTest https://github.com/ruby/ruby/blob/trunk/tool/lib/minitest/unit.rb#L867 ## # Runner for a given +type+ (eg, test vs bench). + def self.current_repeat_count + @@current_repeat_count + end + def _run_anything type suites = TestCase.send "#{type}_suites" return if suites.empty? @@ -880,7 +884,7 @@ module MiniTest https://github.com/ruby/ruby/blob/trunk/tool/lib/minitest/unit.rb#L884 sync = output.respond_to? :"sync=" # stupid emacs old_sync, output.sync = output.sync, true if sync - count = 0 + @@current_repeat_count = 0 begin start = Time.now @@ -891,15 +895,15 @@ module MiniTest https://github.com/ruby/ruby/blob/trunk/tool/lib/minitest/unit.rb#L895 test_count += @test_count assertion_count += @assertion_count t = Time.now - start - count += 1 + @@current_repeat_count += 1 unless @repeat_count puts puts end 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)] - end while @repeat_count && count < @repeat_count && + end while @repeat_count && @@current_repeat_count < @repeat_count && report.empty? && failures.zero? && errors.zero? output.sync = old_sync if sync -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/