mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-04-05 05:00:15 -05:00
Do not trim output whitespace prefix
Whitespace prefix of output lines was carried over from the old v1 version, but in some cases it removes too much whitespace. Ideally it would detect the common prefix of all output lines for a given text and only trim that. Until that's fixed, let's just stop removing the whitespace. Fixes #131
This commit is contained in:
parent
4976b9b9ae
commit
7c195be87f
@ -259,7 +259,7 @@ func formatBenchmarkTime(d time.Duration) string {
|
|||||||
func formatOutput(output []string, indent int) string {
|
func formatOutput(output []string, indent int) string {
|
||||||
var lines []string
|
var lines []string
|
||||||
for _, line := range output {
|
for _, line := range output {
|
||||||
lines = append(lines, gtr.TrimPrefixSpaces(line, indent))
|
lines = append(lines, line)
|
||||||
}
|
}
|
||||||
return strings.Join(lines, "\n")
|
return strings.Join(lines, "\n")
|
||||||
}
|
}
|
||||||
|
8
testdata/002-report.xml
vendored
8
testdata/002-report.xml
vendored
@ -5,10 +5,10 @@
|
|||||||
<property name="go.version" value="1.0"></property>
|
<property name="go.version" value="1.0"></property>
|
||||||
</properties>
|
</properties>
|
||||||
<testcase name="TestOne" classname="package/name" time="0.020">
|
<testcase name="TestOne" classname="package/name" time="0.020">
|
||||||
<failure message="Failed"><![CDATA[file_test.go:11: Error message
|
<failure message="Failed"><![CDATA[ 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 name="TestTwo" classname="package/name" time="0.130"></testcase>
|
<testcase name="TestTwo" classname="package/name" time="0.130"></testcase>
|
||||||
<system-out><![CDATA[exit status 1]]></system-out>
|
<system-out><![CDATA[exit status 1]]></system-out>
|
||||||
|
2
testdata/003-report.xml
vendored
2
testdata/003-report.xml
vendored
@ -5,7 +5,7 @@
|
|||||||
<property name="go.version" value="1.0"></property>
|
<property name="go.version" value="1.0"></property>
|
||||||
</properties>
|
</properties>
|
||||||
<testcase name="TestOne" classname="package/name" time="0.020">
|
<testcase name="TestOne" classname="package/name" time="0.020">
|
||||||
<skipped message="Skipped"><![CDATA[file_test.go:11: Skip message]]></skipped>
|
<skipped message="Skipped"><![CDATA[ file_test.go:11: Skip message]]></skipped>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestTwo" classname="package/name" time="0.130"></testcase>
|
<testcase name="TestTwo" classname="package/name" time="0.130"></testcase>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
|
8
testdata/006-report.xml
vendored
8
testdata/006-report.xml
vendored
@ -11,10 +11,10 @@
|
|||||||
<property name="go.version" value="1.0"></property>
|
<property name="go.version" value="1.0"></property>
|
||||||
</properties>
|
</properties>
|
||||||
<testcase name="TestOne" classname="package/name2" time="0.020">
|
<testcase name="TestOne" classname="package/name2" time="0.020">
|
||||||
<failure message="Failed"><![CDATA[file_test.go:11: Error message
|
<failure message="Failed"><![CDATA[ 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 name="TestTwo" classname="package/name2" time="0.130"></testcase>
|
<testcase name="TestTwo" classname="package/name2" time="0.130"></testcase>
|
||||||
<system-out><![CDATA[exit status 1]]></system-out>
|
<system-out><![CDATA[exit status 1]]></system-out>
|
||||||
|
12
testdata/012-report.xml
vendored
12
testdata/012-report.xml
vendored
@ -20,19 +20,19 @@
|
|||||||
<failure message="Failed"></failure>
|
<failure message="Failed"></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestFour/#00" classname="package/name" time="0.000">
|
<testcase name="TestFour/#00" classname="package/name" time="0.000">
|
||||||
<failure message="Failed"><![CDATA[example.go:12: Expected abc OBTAINED:
|
<failure message="Failed"><![CDATA[ example.go:12: Expected abc OBTAINED:
|
||||||
xyz
|
xyz
|
||||||
example.go:123: Expected and obtained are different.]]></failure>
|
example.go:123: Expected and obtained are different.]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestFour/#01" classname="package/name" time="0.000">
|
<testcase name="TestFour/#01" classname="package/name" time="0.000">
|
||||||
<skipped message="Skipped"><![CDATA[example.go:1234: Not supported yet.]]></skipped>
|
<skipped message="Skipped"><![CDATA[ example.go:1234: Not supported yet.]]></skipped>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestFour/#02" classname="package/name" time="0.000"></testcase>
|
<testcase name="TestFour/#02" classname="package/name" time="0.000"></testcase>
|
||||||
<testcase name="TestFive" classname="package/name" time="0.000">
|
<testcase name="TestFive" classname="package/name" time="0.000">
|
||||||
<skipped message="Skipped"><![CDATA[example.go:1392: Not supported yet.]]></skipped>
|
<skipped message="Skipped"><![CDATA[ example.go:1392: Not supported yet.]]></skipped>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestSix" classname="package/name" time="0.000">
|
<testcase name="TestSix" classname="package/name" time="0.000">
|
||||||
<failure message="Failed"><![CDATA[example.go:371: This should not fail!]]></failure>
|
<failure message="Failed"><![CDATA[ example.go:371: This should not fail!]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
2
testdata/017-report.xml
vendored
2
testdata/017-report.xml
vendored
@ -39,7 +39,7 @@ Goroutine 6 (running) created at:
|
|||||||
main.main()
|
main.main()
|
||||||
_test/_testmain.go:52 +0x20f
|
_test/_testmain.go:52 +0x20f
|
||||||
==================
|
==================
|
||||||
testing.go:610: race detected during execution of test]]></failure>
|
testing.go:610: race detected during execution of test]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<system-out><![CDATA[exit status 1]]></system-out>
|
<system-out><![CDATA[exit status 1]]></system-out>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
|
6
testdata/020-report.xml
vendored
6
testdata/020-report.xml
vendored
@ -7,15 +7,15 @@
|
|||||||
<testcase name="FirstTest" classname="pkg/parallel" time="2.000">
|
<testcase name="FirstTest" classname="pkg/parallel" time="2.000">
|
||||||
<failure message="Failed"><![CDATA[Message from first
|
<failure message="Failed"><![CDATA[Message from first
|
||||||
Supplemental from first
|
Supplemental from first
|
||||||
parallel_test.go:14: FirstTest error]]></failure>
|
parallel_test.go:14: FirstTest error]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="SecondTest" classname="pkg/parallel" time="1.000">
|
<testcase name="SecondTest" classname="pkg/parallel" time="1.000">
|
||||||
<failure message="Failed"><![CDATA[Message from second
|
<failure message="Failed"><![CDATA[Message from second
|
||||||
parallel_test.go:23: SecondTest error]]></failure>
|
parallel_test.go:23: SecondTest error]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="ThirdTest" classname="pkg/parallel" time="0.010">
|
<testcase name="ThirdTest" classname="pkg/parallel" time="0.010">
|
||||||
<failure message="Failed"><![CDATA[Message from third
|
<failure message="Failed"><![CDATA[Message from third
|
||||||
parallel_test.go:32: ThirdTest error]]></failure>
|
parallel_test.go:32: ThirdTest error]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<system-out><![CDATA[exit status 1]]></system-out>
|
<system-out><![CDATA[exit status 1]]></system-out>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
|
32
testdata/030-report.xml
vendored
32
testdata/030-report.xml
vendored
@ -9,10 +9,10 @@
|
|||||||
line
|
line
|
||||||
stdout
|
stdout
|
||||||
single-line stdout
|
single-line stdout
|
||||||
example_test.go:13: single-line error
|
example_test.go:13: single-line error
|
||||||
example_test.go:14: multi
|
example_test.go:14: multi
|
||||||
line
|
line
|
||||||
error]]></failure>
|
error]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestFailWithStdoutAndNoTestOutput" classname="package/name1" time="0.150">
|
<testcase name="TestFailWithStdoutAndNoTestOutput" classname="package/name1" time="0.150">
|
||||||
<failure message="Failed"><![CDATA[multi
|
<failure message="Failed"><![CDATA[multi
|
||||||
@ -21,10 +21,10 @@ stdout
|
|||||||
single-line stdout]]></failure>
|
single-line stdout]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestFailWithTestOutput" classname="package/name1" time="0.200">
|
<testcase name="TestFailWithTestOutput" classname="package/name1" time="0.200">
|
||||||
<failure message="Failed"><![CDATA[example_test.go:26: single-line error
|
<failure message="Failed"><![CDATA[ example_test.go:26: single-line error
|
||||||
example_test.go:27: multi
|
example_test.go:27: multi
|
||||||
line
|
line
|
||||||
error]]></failure>
|
error]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestFailWithNoTestOutput" classname="package/name1" time="0.250">
|
<testcase name="TestFailWithNoTestOutput" classname="package/name1" time="0.250">
|
||||||
<failure message="Failed"></failure>
|
<failure message="Failed"></failure>
|
||||||
@ -41,10 +41,10 @@ example_test.go:27: multi
|
|||||||
line
|
line
|
||||||
stdout
|
stdout
|
||||||
1 single-line stdout
|
1 single-line stdout
|
||||||
example_test.go:65: 1 single-line error
|
example_test.go:65: 1 single-line error
|
||||||
example_test.go:66: 1 multi
|
example_test.go:66: 1 multi
|
||||||
line
|
line
|
||||||
error]]></failure>
|
error]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestSubtests/TestFailWithStdoutAndNoTestOutput" classname="package/name1" time="0.150">
|
<testcase name="TestSubtests/TestFailWithStdoutAndNoTestOutput" classname="package/name1" time="0.150">
|
||||||
<failure message="Failed"><![CDATA[2 multi
|
<failure message="Failed"><![CDATA[2 multi
|
||||||
@ -53,10 +53,10 @@ stdout
|
|||||||
2 single-line stdout]]></failure>
|
2 single-line stdout]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestSubtests/TestFailWithTestOutput" classname="package/name1" time="0.200">
|
<testcase name="TestSubtests/TestFailWithTestOutput" classname="package/name1" time="0.200">
|
||||||
<failure message="Failed"><![CDATA[example_test.go:78: 3 single-line error
|
<failure message="Failed"><![CDATA[ example_test.go:78: 3 single-line error
|
||||||
example_test.go:79: 3 multi
|
example_test.go:79: 3 multi
|
||||||
line
|
line
|
||||||
error]]></failure>
|
error]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestSubtests/TestFailWithNoTestOutput" classname="package/name1" time="0.250">
|
<testcase name="TestSubtests/TestFailWithNoTestOutput" classname="package/name1" time="0.250">
|
||||||
<failure message="Failed"></failure>
|
<failure message="Failed"></failure>
|
||||||
|
8
testdata/101-report.xml
vendored
8
testdata/101-report.xml
vendored
@ -5,10 +5,10 @@
|
|||||||
<property name="go.version" value="1.0"></property>
|
<property name="go.version" value="1.0"></property>
|
||||||
</properties>
|
</properties>
|
||||||
<testcase name="TestOne" classname="package/name/fail" time="0.000">
|
<testcase name="TestOne" classname="package/name/fail" time="0.000">
|
||||||
<failure message="Failed"><![CDATA[main_test.go:6: Error message
|
<failure message="Failed"><![CDATA[ main_test.go:6: Error message
|
||||||
main_test.go:7: Longer
|
main_test.go:7: Longer
|
||||||
error
|
error
|
||||||
message.]]></failure>
|
message.]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestTwo" classname="package/name/fail" time="0.000"></testcase>
|
<testcase name="TestTwo" classname="package/name/fail" time="0.000"></testcase>
|
||||||
<system-out><![CDATA[exit status 1]]></system-out>
|
<system-out><![CDATA[exit status 1]]></system-out>
|
||||||
|
2
testdata/103-report.xml
vendored
2
testdata/103-report.xml
vendored
@ -9,7 +9,7 @@
|
|||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestMultiple/Empty_string" classname="package/name/subtest" time="0.000"></testcase>
|
<testcase name="TestMultiple/Empty_string" classname="package/name/subtest" time="0.000"></testcase>
|
||||||
<testcase name="TestMultiple/Single" classname="package/name/subtest" time="0.000">
|
<testcase name="TestMultiple/Single" classname="package/name/subtest" time="0.000">
|
||||||
<failure message="Failed"><![CDATA[pkg_test.go:20: Do("a"): got aaaaaaaaaa, want a]]></failure>
|
<failure message="Failed"><![CDATA[ pkg_test.go:20: Do("a"): got aaaaaaaaaa, want a]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestMultiple/Multi" classname="package/name/subtest" time="0.000"></testcase>
|
<testcase name="TestMultiple/Multi" classname="package/name/subtest" time="0.000"></testcase>
|
||||||
<system-out><![CDATA[exit status 1]]></system-out>
|
<system-out><![CDATA[exit status 1]]></system-out>
|
||||||
|
4
testdata/104-report.xml
vendored
4
testdata/104-report.xml
vendored
@ -45,9 +45,9 @@ Goroutine 7 (running) created at:
|
|||||||
main.main()
|
main.main()
|
||||||
_testmain.go:47 +0x2e4
|
_testmain.go:47 +0x2e4
|
||||||
==================
|
==================
|
||||||
testing.go:1312: race detected during execution of test]]></failure>
|
testing.go:1312: race detected during execution of test]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<system-out><![CDATA[testing.go:1312: race detected during execution of test
|
<system-out><![CDATA[ testing.go:1312: race detected during execution of test
|
||||||
exit status 1]]></system-out>
|
exit status 1]]></system-out>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
4
testdata/107-report.xml
vendored
4
testdata/107-report.xml
vendored
@ -5,10 +5,10 @@
|
|||||||
<property name="go.version" value="1.0"></property>
|
<property name="go.version" value="1.0"></property>
|
||||||
</properties>
|
</properties>
|
||||||
<testcase name="TestSkip" classname="package/name/skip" time="0.000">
|
<testcase name="TestSkip" classname="package/name/skip" time="0.000">
|
||||||
<skipped message="Skipped"><![CDATA[skip_test.go:6: skip message]]></skipped>
|
<skipped message="Skipped"><![CDATA[ skip_test.go:6: skip message]]></skipped>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestSkipNow" classname="package/name/skip" time="0.000">
|
<testcase name="TestSkipNow" classname="package/name/skip" time="0.000">
|
||||||
<skipped message="Skipped"><![CDATA[skip_test.go:10: log message]]></skipped>
|
<skipped message="Skipped"><![CDATA[ skip_test.go:10: log message]]></skipped>
|
||||||
</testcase>
|
</testcase>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
</testsuites>
|
</testsuites>
|
||||||
|
12
testdata/112-report.xml
vendored
12
testdata/112-report.xml
vendored
@ -5,19 +5,19 @@
|
|||||||
<property name="go.version" value="1.0"></property>
|
<property name="go.version" value="1.0"></property>
|
||||||
</properties>
|
</properties>
|
||||||
<testcase name="TestP1" classname="package/name/parallel" time="0.000">
|
<testcase name="TestP1" classname="package/name/parallel" time="0.000">
|
||||||
<failure message="Failed"><![CDATA[pkg_test.go:10: t.Log(P1)
|
<failure message="Failed"><![CDATA[ pkg_test.go:10: t.Log(P1)
|
||||||
fmt.Printf(P1)
|
fmt.Printf(P1)
|
||||||
pkg_test.go:14: P1 error]]></failure>
|
pkg_test.go:14: P1 error]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestP2" classname="package/name/parallel" time="0.000">
|
<testcase name="TestP2" classname="package/name/parallel" time="0.000">
|
||||||
<failure message="Failed"><![CDATA[pkg_test.go:19: t.Log(P2)
|
<failure message="Failed"><![CDATA[ pkg_test.go:19: t.Log(P2)
|
||||||
fmt.Printf(P2)
|
fmt.Printf(P2)
|
||||||
pkg_test.go:23: P2 error]]></failure>
|
pkg_test.go:23: P2 error]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<testcase name="TestP3" classname="package/name/parallel" time="0.000">
|
<testcase name="TestP3" classname="package/name/parallel" time="0.000">
|
||||||
<failure message="Failed"><![CDATA[pkg_test.go:28: t.Log(P3)
|
<failure message="Failed"><![CDATA[ pkg_test.go:28: t.Log(P3)
|
||||||
fmt.Printf(P3)
|
fmt.Printf(P3)
|
||||||
pkg_test.go:32: P3 error]]></failure>
|
pkg_test.go:32: P3 error]]></failure>
|
||||||
</testcase>
|
</testcase>
|
||||||
<system-out><![CDATA[exit status 1]]></system-out>
|
<system-out><![CDATA[exit status 1]]></system-out>
|
||||||
</testsuite>
|
</testsuite>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user