diff --git a/go-junit-report_test.go b/go-junit-report_test.go index a409b9e..76b5669 100644 --- a/go-junit-report_test.go +++ b/go-junit-report_test.go @@ -329,6 +329,32 @@ var testCases = []TestCase{ }, }, }, + { + name: "11-go_1_5.txt", + reportName: "11-report.xml", + report: &parser.Report{ + Packages: []parser.Package{ + { + Name: "package/name", + Time: 50, + Tests: []*parser.Test{ + { + Name: "TestOne", + Time: 20, + Result: parser.PASS, + Output: []string{}, + }, + { + Name: "TestTwo", + Time: 30, + Result: parser.PASS, + Output: []string{}, + }, + }, + }, + }, + }, + }, } func TestParser(t *testing.T) { diff --git a/parser/parser.go b/parser/parser.go index e5e0673..e2b6650 100644 --- a/parser/parser.go +++ b/parser/parser.go @@ -78,9 +78,9 @@ func Parse(r io.Reader, pkgName string) (*Report, error) { if strings.HasPrefix(line, "=== RUN ") { // new test - cur = line[8:] + cur = strings.TrimSpace(line[8:]) tests = append(tests, &Test{ - Name: line[8:], + Name: cur, Result: FAIL, Output: make([]string, 0), }) diff --git a/tests/11-go_1_5.txt b/tests/11-go_1_5.txt new file mode 100644 index 0000000..2a40cee --- /dev/null +++ b/tests/11-go_1_5.txt @@ -0,0 +1,6 @@ +=== RUN TestOne +--- PASS: TestOne (0.02s) +=== RUN TestTwo +--- PASS: TestTwo (0.03s) +PASS +ok package/name 0.050s diff --git a/tests/11-report.xml b/tests/11-report.xml new file mode 100644 index 0000000..9aa2c82 --- /dev/null +++ b/tests/11-report.xml @@ -0,0 +1,10 @@ + + + + + + + + + +