diff --git a/go-junit-report_test.go b/go-junit-report_test.go index 308ef22..da28d89 100644 --- a/go-junit-report_test.go +++ b/go-junit-report_test.go @@ -738,6 +738,32 @@ var testCases = []TestCase{ }, }, }, + { + name: "19-pass.txt", + reportName: "19-report.xml", + report: &parser.Report{ + Packages: []parser.Package{ + { + Name: "package/name", + Time: 160, + Tests: []*parser.Test{ + { + Name: "TestZ", + Time: 60, + Result: parser.PASS, + Output: []string{}, + }, + { + Name: "TestA", + Time: 100, + Result: parser.PASS, + Output: []string{}, + }, + }, + }, + }, + }, + }, } func TestParser(t *testing.T) { diff --git a/parser/parser.go b/parser/parser.go index ae38dd6..1a671d5 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -40,7 +40,7 @@ type Test struct { } var ( - regexStatus = regexp.MustCompile(`^\s*--- (PASS|FAIL|SKIP): (.+) \((\d+\.\d+)(?: seconds|s)\)$`) + regexStatus = regexp.MustCompile(`\s*--- (PASS|FAIL|SKIP): (.+) \((\d+\.\d+)(?: seconds|s)\)`) regexCoverage = regexp.MustCompile(`^coverage:\s+(\d+\.\d+)%\s+of\s+statements(?:\sin\s.+)?$`) regexResult = regexp.MustCompile(`^(ok|FAIL)\s+([^ ]+)\s+(?:(\d+\.\d+)s|(\[\w+ failed]))(?:\s+coverage:\s+(\d+\.\d+)%\sof\sstatements(?:\sin\s.+)?)?$`) regexOutput = regexp.MustCompile(`( )*\t(.*)`) diff --git a/tests/19-pass.txt b/tests/19-pass.txt new file mode 100644 index 0000000..f2ea3aa --- /dev/null +++ b/tests/19-pass.txt @@ -0,0 +1,6 @@ +=== RUN TestZ +some inline text--- PASS: TestZ (0.06 seconds) +=== RUN TestA +--- PASS: TestA (0.10 seconds) +PASS +ok package/name 0.160s diff --git a/tests/19-report.xml b/tests/19-report.xml new file mode 100644 index 0000000..46141a9 --- /dev/null +++ b/tests/19-report.xml @@ -0,0 +1,10 @@ + + + + + + + + + +