diff --git a/go-junit-report_test.go b/go-junit-report_test.go index d9b99c2..92687f4 100644 --- a/go-junit-report_test.go +++ b/go-junit-report_test.go @@ -59,8 +59,8 @@ var testCases []TestCase = []TestCase{ Output: []string{ "file_test.go:11: Error message", "file_test.go:11: Longer", - "error", - "message.", + "\terror", + "\tmessage.", }, }, { @@ -130,7 +130,7 @@ func TestParser(t *testing.T) { testOutput := strings.Join(test.Output, "\n") expTestOutput := strings.Join(expTest.Output, "\n") if testOutput != expTestOutput { - t.Errorf("Test.Output ==\n%s, want\n%s", testOutput, expTestOutput) + t.Errorf("Test.Output ==\n%s\n, want\n%s", testOutput, expTestOutput) } } } diff --git a/parser.go b/parser.go index a377f9c..c5f62eb 100644 --- a/parser.go +++ b/parser.go @@ -97,7 +97,7 @@ func Parse(r io.Reader) (*Report, error) { test.Time = parseTime(matches[3]) * 10 } else if strings.HasPrefix(line, "\t") { // test output - test.Output = append(test.Output, strings.TrimLeft(line, "\t")) + test.Output = append(test.Output, line[1:]) } } } diff --git a/tests/02-report.xml b/tests/02-report.xml index 3920ed0..e42d7b8 100644 --- a/tests/02-report.xml +++ b/tests/02-report.xml @@ -6,8 +6,8 @@ <testcase classname="name" name="TestOne" time="0.020"> <failure message="Failed" type="">file_test.go:11: Error message file_test.go:11: Longer -error -message.</failure> + error + message.</failure> </testcase> <testcase classname="name" name="TestTwo" time="0.130"></testcase> </testsuite>