diff options
author | Koichi Sasada <ko1@atdot.net> | 2020-01-28 18:13:58 +0900 |
---|---|---|
committer | Koichi Sasada <ko1@atdot.net> | 2020-01-28 18:13:58 +0900 |
commit | 20c1c240145b7db66014020e233b23d12574efae (patch) | |
tree | c86f8f555e0b766838572e9f888bdc8709e55f75 | |
parent | 151533e4bc9dff8efefb251dd25b1d57d3082d19 (diff) | |
download | ruby-20c1c240145b7db66014020e233b23d12574efae.tar.gz |
Minitest::Unit.current_repeat_count
This method returns loop counter for multi-run (0 start).
-rw-r--r-- | tool/lib/minitest/unit.rb | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/tool/lib/minitest/unit.rb b/tool/lib/minitest/unit.rb index 8ac0f146bd..8569b2c495 100644 --- a/tool/lib/minitest/unit.rb +++ b/tool/lib/minitest/unit.rb @@ -867,6 +867,10 @@ module MiniTest ## # 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 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 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 |