failures not counted correctly in some cases.

Summary output added.
This commit is contained in:
2024-12-13 22:24:18 +01:00
parent 0a4ed3a95f
commit b71e4db7db
4 changed files with 56 additions and 15 deletions
+12 -8
View File
@@ -39,8 +39,9 @@ type Test struct {
Tests []*Test `xml:"testsuite,omitempty"`
SystemOut string `xml:"system-out,omitempty"`
parent *Test
t0 time.Time
hasTests bool
parent *Test
t0 time.Time
}
type Result struct {
@@ -121,7 +122,8 @@ func (testsuites *Testsuites) Start(t time.Time, pkg string) {
func (testsuites *Testsuites) Test(t time.Time, pkg string, test string) {
// This can be a test suite as well
testsuites.getTest(t, pkg, test)
testobj := testsuites.getTest(t, pkg, test)
testobj.hasTests = true
}
func (testsuites *Testsuites) Output(t time.Time, pkg string, test string, output string) {
@@ -153,12 +155,14 @@ func (testsuites *Testsuites) Skip(t time.Time, pkg string, test string) {
func (suite *Test) Complete() {
suite.TestCount = 0
suite.Failures = 0
suite.Errors = 0
suite.Disabled = 0
suite.Skipped = 0
if len(suite.Tests) > 0 {
suite.Failures = 0
suite.Errors = 0
suite.Disabled = 0
suite.Skipped = 0
}
if len(suite.Tests) == 0 {
if len(suite.Tests) == 0 && suite.hasTests {
suite.TestCount = 1
}