diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-10-18 12:19:52 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2023-10-18 12:19:52 +0900 |
commit | ff4c98f1251574e32a950f5793fba3afbc0838a7 (patch) | |
tree | a2f6c9cb72d31ce868273549b96bdc2e2d952bd7 /tool/lib/test | |
parent | f13068afaa6f305746d92517662e8c0956d31e7b (diff) |
Fix total count when filters given
Diffstat (limited to 'tool/lib/test')
-rw-r--r-- | tool/lib/test/unit.rb | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/tool/lib/test/unit.rb b/tool/lib/test/unit.rb index 539ba1073c..ecb7edd29f 100644 --- a/tool/lib/test/unit.rb +++ b/tool/lib/test/unit.rb @@ -964,11 +964,14 @@ module Test @output = Output.new(self) unless @options[:testing] filter = options[:filter] type = "#{type}_methods" - total = if filter - suites.inject(0) {|n, suite| n + suite.send(type).grep(filter).size} - else - suites.inject(0) {|n, suite| n + suite.send(type).size} - end + total = suites.sum {|suite| + methods = suite.send(type) + if filter + methods.count {|method| filter === "#{suite}##{method}"} + else + methods.size + end + } @test_count = 0 @total_tests = total.to_s(10) end |