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] @output = Output.new(self) unless @options[:testing]
filter = options[:filter] filter = options[:filter]
type = "#{type}_methods" type = "#{type}_methods"
total = if filter total = suites.sum {|suite|
suites.inject(0) {|n, suite| n + suite.send(type).grep(filter).size} methods = suite.send(type)
else if filter
suites.inject(0) {|n, suite| n + suite.send(type).size} methods.count {|method| filter === "#{suite}##{method}"}
end else
methods.size
end
}
@test_count = 0 @test_count = 0
@total_tests = total.to_s(10) @total_tests = total.to_s(10)
end end