Fix total count when filters given

This commit is contained in:
Nobuyoshi Nakada 2023-10-18 12:19:52 +09:00
parent f13068afaa
commit ff4c98f125
No known key found for this signature in database
GPG Key ID: 3582D74E1FEE4465

View File

@ -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