Only strip the first tab from the output

This commit is contained in:
Joel Stemmer 2012-03-17 12:45:34 +01:00
parent a6dab641a1
commit e0174f066f
3 changed files with 6 additions and 6 deletions

View File

@ -59,8 +59,8 @@ var testCases []TestCase = []TestCase{
Output: []string{ Output: []string{
"file_test.go:11: Error message", "file_test.go:11: Error message",
"file_test.go:11: Longer", "file_test.go:11: Longer",
"error", "\terror",
"message.", "\tmessage.",
}, },
}, },
{ {
@ -130,7 +130,7 @@ func TestParser(t *testing.T) {
testOutput := strings.Join(test.Output, "\n") testOutput := strings.Join(test.Output, "\n")
expTestOutput := strings.Join(expTest.Output, "\n") expTestOutput := strings.Join(expTest.Output, "\n")
if testOutput != expTestOutput { 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)
} }
} }
} }

View File

@ -97,7 +97,7 @@ func Parse(r io.Reader) (*Report, error) {
test.Time = parseTime(matches[3]) * 10 test.Time = parseTime(matches[3]) * 10
} else if strings.HasPrefix(line, "\t") { } else if strings.HasPrefix(line, "\t") {
// test output // test output
test.Output = append(test.Output, strings.TrimLeft(line, "\t")) test.Output = append(test.Output, line[1:])
} }
} }
} }

View File

@ -6,8 +6,8 @@
<testcase classname="name" name="TestOne" time="0.020"> <testcase classname="name" name="TestOne" time="0.020">
<failure message="Failed" type="">file_test.go:11: Error message <failure message="Failed" type="">file_test.go:11: Error message
file_test.go:11: Longer file_test.go:11: Longer
error error
message.</failure> message.</failure>
</testcase> </testcase>
<testcase classname="name" name="TestTwo" time="0.130"></testcase> <testcase classname="name" name="TestTwo" time="0.130"></testcase>
</testsuite> </testsuite>