diff --git a/go-junit-report_test.go b/go-junit-report_test.go index 471e833..853d614 100644 --- a/go-junit-report_test.go +++ b/go-junit-report_test.go @@ -102,6 +102,32 @@ var testCases []TestCase = []TestCase{ }, }, }, + { + name: "04-go_1_4.txt", + reportName: "04-report.xml", + report: &Report{ + Packages: []Package{ + { + Name: "package/name", + Time: 160, + Tests: []Test{ + { + Name: "TestOne", + Time: 60, + Result: PASS, + Output: []string{}, + }, + { + Name: "TestTwo", + Time: 100, + Result: PASS, + Output: []string{}, + }, + }, + }, + }, + }, + }, } func TestParser(t *testing.T) { diff --git a/parser.go b/parser.go index 0fb6aac..3d8213e 100644 --- a/parser.go +++ b/parser.go @@ -34,7 +34,7 @@ type Test struct { } var ( - regexStatus = regexp.MustCompile(`^--- (PASS|FAIL|SKIP): (.+) \((\d+\.\d+) seconds\)$`) + regexStatus = regexp.MustCompile(`^--- (PASS|FAIL|SKIP): (.+) \((\d+\.\d+)(?: seconds|s)\)$`) regexResult = regexp.MustCompile(`^(ok|FAIL)\s+(.+)\s(\d+\.\d+)s$`) ) diff --git a/tests/04-go_1_4.txt b/tests/04-go_1_4.txt new file mode 100644 index 0000000..13fe892 --- /dev/null +++ b/tests/04-go_1_4.txt @@ -0,0 +1,6 @@ +=== RUN TestOne +--- PASS: TestOne (0.06s) +=== RUN TestTwo +--- PASS: TestTwo (0.10s) +PASS +ok package/name 0.160s \ No newline at end of file diff --git a/tests/04-report.xml b/tests/04-report.xml new file mode 100644 index 0000000..2585b80 --- /dev/null +++ b/tests/04-report.xml @@ -0,0 +1,8 @@ + + + + + + + +