mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-04-04 20:50:14 -05:00
parser/gotest: Remove indent for output, add test for race
This commit is contained in:
parent
42bf91bd4d
commit
34ffb9d16d
@ -131,11 +131,9 @@ func (p *parser) coverage(percent string) {
|
||||
}
|
||||
|
||||
func (p *parser) output(line string) {
|
||||
l, indent := stripIndent(line)
|
||||
p.add(Event{
|
||||
Type: "output",
|
||||
Data: l,
|
||||
Indent: indent,
|
||||
Type: "output",
|
||||
Data: line,
|
||||
})
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ var tests = []struct {
|
||||
{Type: "run_test", Id: 2, Name: "TestTwo"},
|
||||
{Type: "end_test", Id: 2, Name: "TestTwo", Result: "PASS", Duration: 130 * time.Millisecond},
|
||||
{Type: "status", Result: "FAIL"},
|
||||
{Type: "output", Data: "exit status 1", Indent: 0},
|
||||
{Type: "output", Data: "exit status 1"},
|
||||
{Type: "summary", Result: "FAIL", Name: "package/name", Duration: 151 * time.Millisecond},
|
||||
}},
|
||||
{"03-skip",
|
||||
@ -75,7 +75,7 @@ var tests = []struct {
|
||||
{Type: "run_test", Id: 4, Name: "TestTwo"},
|
||||
{Type: "end_test", Id: 4, Name: "TestTwo", Result: "PASS", Duration: 130 * time.Millisecond},
|
||||
{Type: "status", Result: "FAIL"},
|
||||
{Type: "output", Data: "exit status 1", Indent: 0},
|
||||
{Type: "output", Data: "exit status 1"},
|
||||
{Type: "summary", Result: "FAIL", Name: "package/name2", Duration: 151 * time.Millisecond},
|
||||
}},
|
||||
{"07-compiled_test",
|
||||
@ -165,11 +165,11 @@ var tests = []struct {
|
||||
{Type: "run_test", Id: 16, Name: "TestFour/#02"},
|
||||
{Type: "end_test", Id: 13, Name: "TestFour", Result: "FAIL", Duration: 20 * time.Millisecond},
|
||||
{Type: "end_test", Id: 14, Name: "TestFour/#00", Result: "FAIL", Indent: 1, Duration: 0},
|
||||
{Type: "output", Data: "\texample.go:12: Expected abc OBTAINED:", Indent: 1},
|
||||
{Type: "output", Data: "\t\txyz", Indent: 1},
|
||||
{Type: "output", Data: "\texample.go:123: Expected and obtained are different.", Indent: 1},
|
||||
{Type: "output", Data: " \texample.go:12: Expected abc OBTAINED:"},
|
||||
{Type: "output", Data: " \t\txyz"},
|
||||
{Type: "output", Data: " \texample.go:123: Expected and obtained are different."},
|
||||
{Type: "end_test", Id: 15, Name: "TestFour/#01", Result: "SKIP", Indent: 1, Duration: 0},
|
||||
{Type: "output", Data: "\texample.go:1234: Not supported yet.", Indent: 1},
|
||||
{Type: "output", Data: " \texample.go:1234: Not supported yet."},
|
||||
{Type: "end_test", Id: 16, Name: "TestFour/#02", Result: "PASS", Indent: 1, Duration: 0},
|
||||
{Type: "run_test", Id: 17, Name: "TestFive"},
|
||||
{Type: "end_test", Id: 17, Name: "TestFive", Result: "SKIP", Duration: 0},
|
||||
@ -229,7 +229,49 @@ var tests = []struct {
|
||||
{Type: "status", Result: "PASS"},
|
||||
{Type: "summary", Result: "ok", Name: "package/repeated-names", Duration: 1 * time.Millisecond},
|
||||
}},
|
||||
{"17-race", []Event{}},
|
||||
{"17-race",
|
||||
[]Event{
|
||||
{Type: "run_test", Id: 1, Name: "TestRace"},
|
||||
{Type: "output", Data: "test output"},
|
||||
{Type: "output", Data: "2 0xc4200153d0"},
|
||||
{Type: "output", Data: "=================="},
|
||||
{Type: "output", Data: "WARNING: DATA RACE"},
|
||||
{Type: "output", Data: "Write at 0x00c4200153d0 by goroutine 7:"},
|
||||
{Type: "output", Data: " race_test.TestRace.func1()"},
|
||||
{Type: "output", Data: " race_test.go:13 +0x3b"},
|
||||
{Type: "output", Data: ""},
|
||||
{Type: "output", Data: "Previous write at 0x00c4200153d0 by goroutine 6:"},
|
||||
{Type: "output", Data: " race_test.TestRace()"},
|
||||
{Type: "output", Data: " race_test.go:15 +0x136"},
|
||||
{Type: "output", Data: " testing.tRunner()"},
|
||||
{Type: "output", Data: " /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107"},
|
||||
{Type: "output", Data: ""},
|
||||
{Type: "output", Data: "Goroutine 7 (running) created at:"},
|
||||
{Type: "output", Data: " race_test.TestRace()"},
|
||||
{Type: "output", Data: " race_test.go:14 +0x125"},
|
||||
{Type: "output", Data: " testing.tRunner()"},
|
||||
{Type: "output", Data: " /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107"},
|
||||
{Type: "output", Data: ""},
|
||||
{Type: "output", Data: "Goroutine 6 (running) created at:"},
|
||||
{Type: "output", Data: " testing.(*T).Run()"},
|
||||
{Type: "output", Data: " /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:697 +0x543"},
|
||||
{Type: "output", Data: " testing.runTests.func1()"},
|
||||
{Type: "output", Data: " /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:882 +0xaa"},
|
||||
{Type: "output", Data: " testing.tRunner()"},
|
||||
{Type: "output", Data: " /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:657 +0x107"},
|
||||
{Type: "output", Data: " testing.runTests()"},
|
||||
{Type: "output", Data: " /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:888 +0x4e0"},
|
||||
{Type: "output", Data: " testing.(*M).Run()"},
|
||||
{Type: "output", Data: " /usr/local/Cellar/go/1.8.3/libexec/src/testing/testing.go:822 +0x1c3"},
|
||||
{Type: "output", Data: " main.main()"},
|
||||
{Type: "output", Data: " _test/_testmain.go:52 +0x20f"},
|
||||
{Type: "output", Data: "=================="},
|
||||
{Type: "end_test", Id: 1, Name: "TestRace", Result: "FAIL"},
|
||||
{Type: "output", Data: "\ttesting.go:610: race detected during execution of test"},
|
||||
{Type: "status", Result: "FAIL"},
|
||||
{Type: "output", Data: "exit status 1"},
|
||||
{Type: "summary", Result: "FAIL", Name: "race_test", Duration: 15 * time.Millisecond},
|
||||
}},
|
||||
{"18-coverpkg", []Event{}},
|
||||
{"19-pass", []Event{}},
|
||||
{"20-parallel", []Event{}},
|
||||
|
Loading…
x
Reference in New Issue
Block a user