mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-04-05 05:00:15 -05:00
parser/gotest: Make parser/gotest parser stateless
This commit is contained in:
parent
c2e4b698fc
commit
c6349bc2f5
@ -14,7 +14,6 @@ import (
|
|||||||
type Event struct {
|
type Event struct {
|
||||||
Type string
|
Type string
|
||||||
|
|
||||||
Id int
|
|
||||||
Name string
|
Name string
|
||||||
Result string
|
Result string
|
||||||
Duration time.Duration
|
Duration time.Duration
|
||||||
@ -49,7 +48,6 @@ func Parse(r io.Reader) ([]Event, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type parser struct {
|
type parser struct {
|
||||||
id int
|
|
||||||
events []Event
|
events []Event
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -77,39 +75,16 @@ func (p *parser) add(event Event) {
|
|||||||
p.events = append(p.events, event)
|
p.events = append(p.events, event)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *parser) findTest(name string) int {
|
|
||||||
for i := len(p.events) - 1; i >= 0; i-- {
|
|
||||||
// TODO: should we only consider tests that haven't ended yet?
|
|
||||||
if p.events[i].Type == "run_test" && p.events[i].Name == name {
|
|
||||||
return p.events[i].Id
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return -1
|
|
||||||
}
|
|
||||||
|
|
||||||
func (p *parser) runTest(name string) {
|
func (p *parser) runTest(name string) {
|
||||||
p.id += 1
|
p.add(Event{Type: "run_test", Name: name})
|
||||||
p.add(Event{
|
|
||||||
Type: "run_test",
|
|
||||||
Id: p.id,
|
|
||||||
Name: name,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *parser) pauseTest(name string) {
|
func (p *parser) pauseTest(name string) {
|
||||||
p.add(Event{
|
p.add(Event{Type: "pause_test", Name: name})
|
||||||
Type: "pause_test",
|
|
||||||
Id: p.findTest(name),
|
|
||||||
Name: name,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *parser) contTest(name string) {
|
func (p *parser) contTest(name string) {
|
||||||
p.add(Event{
|
p.add(Event{Type: "cont_test", Name: name})
|
||||||
Type: "cont_test",
|
|
||||||
Id: p.findTest(name),
|
|
||||||
Name: name,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *parser) endTest(line, indent, result, name, duration string) {
|
func (p *parser) endTest(line, indent, result, name, duration string) {
|
||||||
@ -119,7 +94,6 @@ func (p *parser) endTest(line, indent, result, name, duration string) {
|
|||||||
_, n := stripIndent(indent)
|
_, n := stripIndent(indent)
|
||||||
p.add(Event{
|
p.add(Event{
|
||||||
Type: "end_test",
|
Type: "end_test",
|
||||||
Id: p.findTest(name),
|
|
||||||
Name: name,
|
Name: name,
|
||||||
Result: result,
|
Result: result,
|
||||||
Indent: n,
|
Indent: n,
|
||||||
@ -128,10 +102,7 @@ func (p *parser) endTest(line, indent, result, name, duration string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *parser) status(result string) {
|
func (p *parser) status(result string) {
|
||||||
p.add(Event{
|
p.add(Event{Type: "status", Result: result})
|
||||||
Type: "status",
|
|
||||||
Result: result,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (p *parser) summary(result, name, duration, data, covpct, packages string) {
|
func (p *parser) summary(result, name, duration, data, covpct, packages string) {
|
||||||
@ -155,10 +126,7 @@ func (p *parser) coverage(percent, packages string) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (p *parser) output(line string) {
|
func (p *parser) output(line string) {
|
||||||
p.add(Event{
|
p.add(Event{Type: "output", Data: line})
|
||||||
Type: "output",
|
|
||||||
Data: line,
|
|
||||||
})
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseSeconds(s string) time.Duration {
|
func parseSeconds(s string) time.Duration {
|
||||||
|
@ -17,83 +17,83 @@ var tests = []struct {
|
|||||||
}{
|
}{
|
||||||
{"01-pass",
|
{"01-pass",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestZ"},
|
{Type: "run_test", Name: "TestZ"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestZ", Result: "PASS", Duration: 60 * time.Millisecond},
|
{Type: "end_test", Name: "TestZ", Result: "PASS", Duration: 60 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 2, Name: "TestA"},
|
{Type: "run_test", Name: "TestA"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestA", Result: "PASS", Duration: 100 * time.Millisecond},
|
{Type: "end_test", Name: "TestA", Result: "PASS", Duration: 100 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "summary", Result: "ok", Name: "package/name", Duration: 160 * time.Millisecond},
|
{Type: "summary", Result: "ok", Name: "package/name", Duration: 160 * time.Millisecond},
|
||||||
}},
|
}},
|
||||||
{"02-fail",
|
{"02-fail",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestOne"},
|
{Type: "run_test", Name: "TestOne"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestOne", Result: "FAIL", Duration: 20 * time.Millisecond},
|
{Type: "end_test", Name: "TestOne", Result: "FAIL", Duration: 20 * time.Millisecond},
|
||||||
{Type: "output", Data: "\tfile_test.go:11: Error message"},
|
{Type: "output", Data: "\tfile_test.go:11: Error message"},
|
||||||
{Type: "output", Data: "\tfile_test.go:11: Longer"},
|
{Type: "output", Data: "\tfile_test.go:11: Longer"},
|
||||||
{Type: "output", Data: "\t\terror"},
|
{Type: "output", Data: "\t\terror"},
|
||||||
{Type: "output", Data: "\t\tmessage."},
|
{Type: "output", Data: "\t\tmessage."},
|
||||||
{Type: "run_test", Id: 2, Name: "TestTwo"},
|
{Type: "run_test", Name: "TestTwo"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestTwo", Result: "PASS", Duration: 130 * time.Millisecond},
|
{Type: "end_test", Name: "TestTwo", Result: "PASS", Duration: 130 * time.Millisecond},
|
||||||
{Type: "status", Result: "FAIL"},
|
{Type: "status", Result: "FAIL"},
|
||||||
{Type: "output", Data: "exit status 1"},
|
{Type: "output", Data: "exit status 1"},
|
||||||
{Type: "summary", Result: "FAIL", Name: "package/name", Duration: 151 * time.Millisecond},
|
{Type: "summary", Result: "FAIL", Name: "package/name", Duration: 151 * time.Millisecond},
|
||||||
}},
|
}},
|
||||||
{"03-skip",
|
{"03-skip",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestOne"},
|
{Type: "run_test", Name: "TestOne"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestOne", Result: "SKIP", Duration: 20 * time.Millisecond},
|
{Type: "end_test", Name: "TestOne", Result: "SKIP", Duration: 20 * time.Millisecond},
|
||||||
{Type: "output", Data: "\tfile_test.go:11: Skip message"},
|
{Type: "output", Data: "\tfile_test.go:11: Skip message"},
|
||||||
{Type: "run_test", Id: 2, Name: "TestTwo"},
|
{Type: "run_test", Name: "TestTwo"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestTwo", Result: "PASS", Duration: 130 * time.Millisecond},
|
{Type: "end_test", Name: "TestTwo", Result: "PASS", Duration: 130 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "summary", Result: "ok", Name: "package/name", Duration: 150 * time.Millisecond},
|
{Type: "summary", Result: "ok", Name: "package/name", Duration: 150 * time.Millisecond},
|
||||||
}},
|
}},
|
||||||
{"04-go_1_4",
|
{"04-go_1_4",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestOne"},
|
{Type: "run_test", Name: "TestOne"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestOne", Result: "PASS", Duration: 60 * time.Millisecond},
|
{Type: "end_test", Name: "TestOne", Result: "PASS", Duration: 60 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 2, Name: "TestTwo"},
|
{Type: "run_test", Name: "TestTwo"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestTwo", Result: "PASS", Duration: 100 * time.Millisecond},
|
{Type: "end_test", Name: "TestTwo", Result: "PASS", Duration: 100 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "summary", Result: "ok", Name: "package/name", Duration: 160 * time.Millisecond},
|
{Type: "summary", Result: "ok", Name: "package/name", Duration: 160 * time.Millisecond},
|
||||||
}},
|
}},
|
||||||
// Test 05 is skipped, because it was actually testing XML output
|
// Test 05 is skipped, because it was actually testing XML output
|
||||||
{"06-mixed",
|
{"06-mixed",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestOne"},
|
{Type: "run_test", Name: "TestOne"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestOne", Result: "PASS", Duration: 60 * time.Millisecond},
|
{Type: "end_test", Name: "TestOne", Result: "PASS", Duration: 60 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 2, Name: "TestTwo"},
|
{Type: "run_test", Name: "TestTwo"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestTwo", Result: "PASS", Duration: 100 * time.Millisecond},
|
{Type: "end_test", Name: "TestTwo", Result: "PASS", Duration: 100 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "summary", Result: "ok", Name: "package/name1", Duration: 160 * time.Millisecond},
|
{Type: "summary", Result: "ok", Name: "package/name1", Duration: 160 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 3, Name: "TestOne"},
|
{Type: "run_test", Name: "TestOne"},
|
||||||
{Type: "end_test", Id: 3, Name: "TestOne", Result: "FAIL", Duration: 20 * time.Millisecond},
|
{Type: "end_test", Name: "TestOne", Result: "FAIL", Duration: 20 * time.Millisecond},
|
||||||
{Type: "output", Data: "\tfile_test.go:11: Error message"},
|
{Type: "output", Data: "\tfile_test.go:11: Error message"},
|
||||||
{Type: "output", Data: "\tfile_test.go:11: Longer"},
|
{Type: "output", Data: "\tfile_test.go:11: Longer"},
|
||||||
{Type: "output", Data: "\t\terror"},
|
{Type: "output", Data: "\t\terror"},
|
||||||
{Type: "output", Data: "\t\tmessage."},
|
{Type: "output", Data: "\t\tmessage."},
|
||||||
{Type: "run_test", Id: 4, Name: "TestTwo"},
|
{Type: "run_test", Name: "TestTwo"},
|
||||||
{Type: "end_test", Id: 4, Name: "TestTwo", Result: "PASS", Duration: 130 * time.Millisecond},
|
{Type: "end_test", Name: "TestTwo", Result: "PASS", Duration: 130 * time.Millisecond},
|
||||||
{Type: "status", Result: "FAIL"},
|
{Type: "status", Result: "FAIL"},
|
||||||
{Type: "output", Data: "exit status 1"},
|
{Type: "output", Data: "exit status 1"},
|
||||||
{Type: "summary", Result: "FAIL", Name: "package/name2", Duration: 151 * time.Millisecond},
|
{Type: "summary", Result: "FAIL", Name: "package/name2", Duration: 151 * time.Millisecond},
|
||||||
}},
|
}},
|
||||||
{"07-compiled_test",
|
{"07-compiled_test",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestOne"},
|
{Type: "run_test", Name: "TestOne"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestOne", Result: "PASS", Duration: 60 * time.Millisecond},
|
{Type: "end_test", Name: "TestOne", Result: "PASS", Duration: 60 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 2, Name: "TestTwo"},
|
{Type: "run_test", Name: "TestTwo"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestTwo", Result: "PASS", Duration: 100 * time.Millisecond},
|
{Type: "end_test", Name: "TestTwo", Result: "PASS", Duration: 100 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
}},
|
}},
|
||||||
{"08-parallel",
|
{"08-parallel",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestDoFoo"},
|
{Type: "run_test", Name: "TestDoFoo"},
|
||||||
{Type: "run_test", Id: 2, Name: "TestDoFoo2"},
|
{Type: "run_test", Name: "TestDoFoo2"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestDoFoo", Result: "PASS", Duration: 270 * time.Millisecond},
|
{Type: "end_test", Name: "TestDoFoo", Result: "PASS", Duration: 270 * time.Millisecond},
|
||||||
{Type: "output", Data: "\tcov_test.go:10: DoFoo log 1"},
|
{Type: "output", Data: "\tcov_test.go:10: DoFoo log 1"},
|
||||||
{Type: "output", Data: "\tcov_test.go:10: DoFoo log 2"},
|
{Type: "output", Data: "\tcov_test.go:10: DoFoo log 2"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestDoFoo2", Result: "PASS", Duration: 160 * time.Millisecond},
|
{Type: "end_test", Name: "TestDoFoo2", Result: "PASS", Duration: 160 * time.Millisecond},
|
||||||
{Type: "output", Data: "\tcov_test.go:21: DoFoo2 log 1"},
|
{Type: "output", Data: "\tcov_test.go:21: DoFoo2 log 1"},
|
||||||
{Type: "output", Data: "\tcov_test.go:21: DoFoo2 log 2"},
|
{Type: "output", Data: "\tcov_test.go:21: DoFoo2 log 2"},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
@ -101,81 +101,81 @@ var tests = []struct {
|
|||||||
}},
|
}},
|
||||||
{"09-coverage",
|
{"09-coverage",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestZ"},
|
{Type: "run_test", Name: "TestZ"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestZ", Result: "PASS", Duration: 60 * time.Millisecond},
|
{Type: "end_test", Name: "TestZ", Result: "PASS", Duration: 60 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 2, Name: "TestA"},
|
{Type: "run_test", Name: "TestA"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestA", Result: "PASS", Duration: 100 * time.Millisecond},
|
{Type: "end_test", Name: "TestA", Result: "PASS", Duration: 100 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "coverage", CovPct: 13.37},
|
{Type: "coverage", CovPct: 13.37},
|
||||||
{Type: "summary", Result: "ok", Name: "package/name", Duration: 160 * time.Millisecond},
|
{Type: "summary", Result: "ok", Name: "package/name", Duration: 160 * time.Millisecond},
|
||||||
}},
|
}},
|
||||||
{"10-multipkg-coverage",
|
{"10-multipkg-coverage",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestA"},
|
{Type: "run_test", Name: "TestA"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestA", Result: "PASS", Duration: 100 * time.Millisecond},
|
{Type: "end_test", Name: "TestA", Result: "PASS", Duration: 100 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 2, Name: "TestB"},
|
{Type: "run_test", Name: "TestB"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestB", Result: "PASS", Duration: 300 * time.Millisecond},
|
{Type: "end_test", Name: "TestB", Result: "PASS", Duration: 300 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "coverage", CovPct: 10},
|
{Type: "coverage", CovPct: 10},
|
||||||
{Type: "summary", Result: "ok", Name: "package1/foo", Duration: 400 * time.Millisecond, CovPct: 10},
|
{Type: "summary", Result: "ok", Name: "package1/foo", Duration: 400 * time.Millisecond, CovPct: 10},
|
||||||
{Type: "run_test", Id: 3, Name: "TestC"},
|
{Type: "run_test", Name: "TestC"},
|
||||||
{Type: "end_test", Id: 3, Name: "TestC", Result: "PASS", Duration: 4200 * time.Millisecond},
|
{Type: "end_test", Name: "TestC", Result: "PASS", Duration: 4200 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "coverage", CovPct: 99.8},
|
{Type: "coverage", CovPct: 99.8},
|
||||||
{Type: "summary", Result: "ok", Name: "package2/bar", Duration: 4200 * time.Millisecond, CovPct: 99.8},
|
{Type: "summary", Result: "ok", Name: "package2/bar", Duration: 4200 * time.Millisecond, CovPct: 99.8},
|
||||||
}},
|
}},
|
||||||
{"11-go_1_5",
|
{"11-go_1_5",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestOne"},
|
{Type: "run_test", Name: "TestOne"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestOne", Result: "PASS", Duration: 20 * time.Millisecond},
|
{Type: "end_test", Name: "TestOne", Result: "PASS", Duration: 20 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 2, Name: "TestTwo"},
|
{Type: "run_test", Name: "TestTwo"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestTwo", Result: "PASS", Duration: 30 * time.Millisecond},
|
{Type: "end_test", Name: "TestTwo", Result: "PASS", Duration: 30 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "summary", Result: "ok", Name: "package/name", Duration: 50 * time.Millisecond},
|
{Type: "summary", Result: "ok", Name: "package/name", Duration: 50 * time.Millisecond},
|
||||||
}},
|
}},
|
||||||
{"12-go_1_7",
|
{"12-go_1_7",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestOne"},
|
{Type: "run_test", Name: "TestOne"},
|
||||||
{Type: "run_test", Id: 2, Name: "TestOne/Child"},
|
{Type: "run_test", Name: "TestOne/Child"},
|
||||||
{Type: "run_test", Id: 3, Name: "TestOne/Child#01"},
|
{Type: "run_test", Name: "TestOne/Child#01"},
|
||||||
{Type: "run_test", Id: 4, Name: "TestOne/Child=02"},
|
{Type: "run_test", Name: "TestOne/Child=02"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestOne", Result: "PASS", Duration: 10 * time.Millisecond},
|
{Type: "end_test", Name: "TestOne", Result: "PASS", Duration: 10 * time.Millisecond},
|
||||||
{Type: "end_test", Id: 2, Name: "TestOne/Child", Result: "PASS", Indent: 1, Duration: 20 * time.Millisecond},
|
{Type: "end_test", Name: "TestOne/Child", Result: "PASS", Indent: 1, Duration: 20 * time.Millisecond},
|
||||||
{Type: "end_test", Id: 3, Name: "TestOne/Child#01", Result: "PASS", Indent: 1, Duration: 30 * time.Millisecond},
|
{Type: "end_test", Name: "TestOne/Child#01", Result: "PASS", Indent: 1, Duration: 30 * time.Millisecond},
|
||||||
{Type: "end_test", Id: 4, Name: "TestOne/Child=02", Result: "PASS", Indent: 1, Duration: 40 * time.Millisecond},
|
{Type: "end_test", Name: "TestOne/Child=02", Result: "PASS", Indent: 1, Duration: 40 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 5, Name: "TestTwo"},
|
{Type: "run_test", Name: "TestTwo"},
|
||||||
{Type: "run_test", Id: 6, Name: "TestTwo/Child"},
|
{Type: "run_test", Name: "TestTwo/Child"},
|
||||||
{Type: "run_test", Id: 7, Name: "TestTwo/Child#01"},
|
{Type: "run_test", Name: "TestTwo/Child#01"},
|
||||||
{Type: "run_test", Id: 8, Name: "TestTwo/Child=02"},
|
{Type: "run_test", Name: "TestTwo/Child=02"},
|
||||||
{Type: "end_test", Id: 5, Name: "TestTwo", Result: "PASS", Duration: 10 * time.Millisecond},
|
{Type: "end_test", Name: "TestTwo", Result: "PASS", Duration: 10 * time.Millisecond},
|
||||||
{Type: "end_test", Id: 6, Name: "TestTwo/Child", Result: "PASS", Indent: 1, Duration: 20 * time.Millisecond},
|
{Type: "end_test", Name: "TestTwo/Child", Result: "PASS", Indent: 1, Duration: 20 * time.Millisecond},
|
||||||
{Type: "end_test", Id: 7, Name: "TestTwo/Child#01", Result: "PASS", Indent: 1, Duration: 30 * time.Millisecond},
|
{Type: "end_test", Name: "TestTwo/Child#01", Result: "PASS", Indent: 1, Duration: 30 * time.Millisecond},
|
||||||
{Type: "end_test", Id: 8, Name: "TestTwo/Child=02", Result: "PASS", Indent: 1, Duration: 40 * time.Millisecond},
|
{Type: "end_test", Name: "TestTwo/Child=02", Result: "PASS", Indent: 1, Duration: 40 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 9, Name: "TestThree"},
|
{Type: "run_test", Name: "TestThree"},
|
||||||
{Type: "run_test", Id: 10, Name: "TestThree/a#1"},
|
{Type: "run_test", Name: "TestThree/a#1"},
|
||||||
{Type: "run_test", Id: 11, Name: "TestThree/a#1/b#1"},
|
{Type: "run_test", Name: "TestThree/a#1/b#1"},
|
||||||
{Type: "run_test", Id: 12, Name: "TestThree/a#1/b#1/c#1"},
|
{Type: "run_test", Name: "TestThree/a#1/b#1/c#1"},
|
||||||
{Type: "end_test", Id: 9, Name: "TestThree", Result: "PASS", Duration: 10 * time.Millisecond},
|
{Type: "end_test", Name: "TestThree", Result: "PASS", Duration: 10 * time.Millisecond},
|
||||||
{Type: "end_test", Id: 10, Name: "TestThree/a#1", Result: "PASS", Indent: 1, Duration: 20 * time.Millisecond},
|
{Type: "end_test", Name: "TestThree/a#1", Result: "PASS", Indent: 1, Duration: 20 * time.Millisecond},
|
||||||
{Type: "end_test", Id: 11, Name: "TestThree/a#1/b#1", Result: "PASS", Indent: 2, Duration: 30 * time.Millisecond},
|
{Type: "end_test", Name: "TestThree/a#1/b#1", Result: "PASS", Indent: 2, Duration: 30 * time.Millisecond},
|
||||||
{Type: "end_test", Id: 12, Name: "TestThree/a#1/b#1/c#1", Result: "PASS", Indent: 3, Duration: 40 * time.Millisecond},
|
{Type: "end_test", Name: "TestThree/a#1/b#1/c#1", Result: "PASS", Indent: 3, Duration: 40 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 13, Name: "TestFour"},
|
{Type: "run_test", Name: "TestFour"},
|
||||||
{Type: "run_test", Id: 14, Name: "TestFour/#00"},
|
{Type: "run_test", Name: "TestFour/#00"},
|
||||||
{Type: "run_test", Id: 15, Name: "TestFour/#01"},
|
{Type: "run_test", Name: "TestFour/#01"},
|
||||||
{Type: "run_test", Id: 16, Name: "TestFour/#02"},
|
{Type: "run_test", Name: "TestFour/#02"},
|
||||||
{Type: "end_test", Id: 13, Name: "TestFour", Result: "FAIL", Duration: 20 * time.Millisecond},
|
{Type: "end_test", Name: "TestFour", Result: "FAIL", Duration: 20 * time.Millisecond},
|
||||||
{Type: "end_test", Id: 14, Name: "TestFour/#00", Result: "FAIL", Indent: 1, Duration: 0},
|
{Type: "end_test", Name: "TestFour/#00", Result: "FAIL", Indent: 1, Duration: 0},
|
||||||
{Type: "output", Data: " \texample.go:12: Expected abc OBTAINED:"},
|
{Type: "output", Data: " \texample.go:12: Expected abc OBTAINED:"},
|
||||||
{Type: "output", Data: " \t\txyz"},
|
{Type: "output", Data: " \t\txyz"},
|
||||||
{Type: "output", Data: " \texample.go:123: Expected and obtained are different."},
|
{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: "end_test", Name: "TestFour/#01", Result: "SKIP", Indent: 1, Duration: 0},
|
||||||
{Type: "output", Data: " \texample.go:1234: Not supported yet."},
|
{Type: "output", Data: " \texample.go:1234: Not supported yet."},
|
||||||
{Type: "end_test", Id: 16, Name: "TestFour/#02", Result: "PASS", Indent: 1, Duration: 0},
|
{Type: "end_test", Name: "TestFour/#02", Result: "PASS", Indent: 1, Duration: 0},
|
||||||
{Type: "run_test", Id: 17, Name: "TestFive"},
|
{Type: "run_test", Name: "TestFive"},
|
||||||
{Type: "end_test", Id: 17, Name: "TestFive", Result: "SKIP", Duration: 0},
|
{Type: "end_test", Name: "TestFive", Result: "SKIP", Duration: 0},
|
||||||
{Type: "output", Data: "\texample.go:1392: Not supported yet."},
|
{Type: "output", Data: "\texample.go:1392: Not supported yet."},
|
||||||
{Type: "run_test", Id: 18, Name: "TestSix"},
|
{Type: "run_test", Name: "TestSix"},
|
||||||
{Type: "end_test", Id: 18, Name: "TestSix", Result: "FAIL", Duration: 0},
|
{Type: "end_test", Name: "TestSix", Result: "FAIL", Duration: 0},
|
||||||
{Type: "output", Data: "\texample.go:371: This should not fail!"},
|
{Type: "output", Data: "\texample.go:371: This should not fail!"},
|
||||||
{Type: "status", Result: "FAIL"},
|
{Type: "status", Result: "FAIL"},
|
||||||
{Type: "summary", Result: "FAIL", Name: "package/name", Duration: 50 * time.Millisecond},
|
{Type: "summary", Result: "FAIL", Name: "package/name", Duration: 50 * time.Millisecond},
|
||||||
@ -191,12 +191,12 @@ var tests = []struct {
|
|||||||
{Type: "output", Data: " /path/vendor (vendor tree)"},
|
{Type: "output", Data: " /path/vendor (vendor tree)"},
|
||||||
{Type: "output", Data: " /path/go/root (from $GOROOT)"},
|
{Type: "output", Data: " /path/go/root (from $GOROOT)"},
|
||||||
{Type: "output", Data: " /path/go/path (from $GOPATH)"},
|
{Type: "output", Data: " /path/go/path (from $GOPATH)"},
|
||||||
{Type: "run_test", Id: 1, Name: "TestA"},
|
{Type: "run_test", Name: "TestA"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestA", Result: "PASS", Duration: 100 * time.Millisecond},
|
{Type: "end_test", Name: "TestA", Result: "PASS", Duration: 100 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "summary", Result: "ok", Name: "package/name/passing1", Duration: 100 * time.Millisecond},
|
{Type: "summary", Result: "ok", Name: "package/name/passing1", Duration: 100 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 2, Name: "TestB"},
|
{Type: "run_test", Name: "TestB"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestB", Result: "PASS", Duration: 100 * time.Millisecond},
|
{Type: "end_test", Name: "TestB", Result: "PASS", Duration: 100 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "summary", Result: "ok", Name: "package/name/passing2", Duration: 100 * time.Millisecond},
|
{Type: "summary", Result: "ok", Name: "package/name/passing2", Duration: 100 * time.Millisecond},
|
||||||
{Type: "summary", Result: "FAIL", Name: "package/name/failing1", Data: "[build failed]"},
|
{Type: "summary", Result: "FAIL", Name: "package/name/failing1", Data: "[build failed]"},
|
||||||
@ -220,18 +220,18 @@ var tests = []struct {
|
|||||||
}},
|
}},
|
||||||
{"16-repeated-names",
|
{"16-repeated-names",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestRepeat"},
|
{Type: "run_test", Name: "TestRepeat"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestRepeat", Result: "PASS"},
|
{Type: "end_test", Name: "TestRepeat", Result: "PASS"},
|
||||||
{Type: "run_test", Id: 2, Name: "TestRepeat"},
|
{Type: "run_test", Name: "TestRepeat"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestRepeat", Result: "PASS"},
|
{Type: "end_test", Name: "TestRepeat", Result: "PASS"},
|
||||||
{Type: "run_test", Id: 3, Name: "TestRepeat"},
|
{Type: "run_test", Name: "TestRepeat"},
|
||||||
{Type: "end_test", Id: 3, Name: "TestRepeat", Result: "PASS"},
|
{Type: "end_test", Name: "TestRepeat", Result: "PASS"},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "summary", Result: "ok", Name: "package/repeated-names", Duration: 1 * time.Millisecond},
|
{Type: "summary", Result: "ok", Name: "package/repeated-names", Duration: 1 * time.Millisecond},
|
||||||
}},
|
}},
|
||||||
{"17-race",
|
{"17-race",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestRace"},
|
{Type: "run_test", Name: "TestRace"},
|
||||||
{Type: "output", Data: "test output"},
|
{Type: "output", Data: "test output"},
|
||||||
{Type: "output", Data: "2 0xc4200153d0"},
|
{Type: "output", Data: "2 0xc4200153d0"},
|
||||||
{Type: "output", Data: "=================="},
|
{Type: "output", Data: "=================="},
|
||||||
@ -266,7 +266,7 @@ var tests = []struct {
|
|||||||
{Type: "output", Data: " main.main()"},
|
{Type: "output", Data: " main.main()"},
|
||||||
{Type: "output", Data: " _test/_testmain.go:52 +0x20f"},
|
{Type: "output", Data: " _test/_testmain.go:52 +0x20f"},
|
||||||
{Type: "output", Data: "=================="},
|
{Type: "output", Data: "=================="},
|
||||||
{Type: "end_test", Id: 1, Name: "TestRace", Result: "FAIL"},
|
{Type: "end_test", Name: "TestRace", Result: "FAIL"},
|
||||||
{Type: "output", Data: "\ttesting.go:610: race detected during execution of test"},
|
{Type: "output", Data: "\ttesting.go:610: race detected during execution of test"},
|
||||||
{Type: "status", Result: "FAIL"},
|
{Type: "status", Result: "FAIL"},
|
||||||
{Type: "output", Data: "exit status 1"},
|
{Type: "output", Data: "exit status 1"},
|
||||||
@ -274,46 +274,46 @@ var tests = []struct {
|
|||||||
}},
|
}},
|
||||||
{"18-coverpkg",
|
{"18-coverpkg",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestA"},
|
{Type: "run_test", Name: "TestA"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestA", Result: "PASS", Duration: 100 * time.Millisecond},
|
{Type: "end_test", Name: "TestA", Result: "PASS", Duration: 100 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 2, Name: "TestB"},
|
{Type: "run_test", Name: "TestB"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestB", Result: "PASS", Duration: 300 * time.Millisecond},
|
{Type: "end_test", Name: "TestB", Result: "PASS", Duration: 300 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "coverage", CovPct: 10, CovPackages: []string{"fmt", "encoding/xml"}},
|
{Type: "coverage", CovPct: 10, CovPackages: []string{"fmt", "encoding/xml"}},
|
||||||
{Type: "summary", Result: "ok", Name: "package1/foo", Duration: 400 * time.Millisecond, CovPct: 10, CovPackages: []string{"fmt", "encoding/xml"}},
|
{Type: "summary", Result: "ok", Name: "package1/foo", Duration: 400 * time.Millisecond, CovPct: 10, CovPackages: []string{"fmt", "encoding/xml"}},
|
||||||
{Type: "run_test", Id: 3, Name: "TestC"},
|
{Type: "run_test", Name: "TestC"},
|
||||||
{Type: "end_test", Id: 3, Name: "TestC", Result: "PASS", Duration: 4200 * time.Millisecond},
|
{Type: "end_test", Name: "TestC", Result: "PASS", Duration: 4200 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "coverage", CovPct: 99.8, CovPackages: []string{"fmt", "encoding/xml"}},
|
{Type: "coverage", CovPct: 99.8, CovPackages: []string{"fmt", "encoding/xml"}},
|
||||||
{Type: "summary", Result: "ok", Name: "package2/bar", Duration: 4200 * time.Millisecond, CovPct: 99.8, CovPackages: []string{"fmt", "encoding/xml"}},
|
{Type: "summary", Result: "ok", Name: "package2/bar", Duration: 4200 * time.Millisecond, CovPct: 99.8, CovPackages: []string{"fmt", "encoding/xml"}},
|
||||||
}},
|
}},
|
||||||
{"19-pass",
|
{"19-pass",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestZ"},
|
{Type: "run_test", Name: "TestZ"},
|
||||||
{Type: "output", Data: "some inline text"},
|
{Type: "output", Data: "some inline text"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestZ", Result: "PASS", Duration: 60 * time.Millisecond},
|
{Type: "end_test", Name: "TestZ", Result: "PASS", Duration: 60 * time.Millisecond},
|
||||||
{Type: "run_test", Id: 2, Name: "TestA"},
|
{Type: "run_test", Name: "TestA"},
|
||||||
{Type: "end_test", Id: 2, Name: "TestA", Result: "PASS", Duration: 100 * time.Millisecond},
|
{Type: "end_test", Name: "TestA", Result: "PASS", Duration: 100 * time.Millisecond},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "summary", Result: "ok", Name: "package/name", Duration: 160 * time.Millisecond},
|
{Type: "summary", Result: "ok", Name: "package/name", Duration: 160 * time.Millisecond},
|
||||||
}},
|
}},
|
||||||
{"20-parallel",
|
{"20-parallel",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "FirstTest"},
|
{Type: "run_test", Name: "FirstTest"},
|
||||||
{Type: "output", Data: "Message from first"},
|
{Type: "output", Data: "Message from first"},
|
||||||
{Type: "pause_test", Id: 1, Name: "FirstTest"},
|
{Type: "pause_test", Name: "FirstTest"},
|
||||||
{Type: "run_test", Id: 2, Name: "SecondTest"},
|
{Type: "run_test", Name: "SecondTest"},
|
||||||
{Type: "output", Data: "Message from second"},
|
{Type: "output", Data: "Message from second"},
|
||||||
{Type: "pause_test", Id: 2, Name: "SecondTest"},
|
{Type: "pause_test", Name: "SecondTest"},
|
||||||
{Type: "cont_test", Id: 1, Name: "FirstTest"},
|
{Type: "cont_test", Name: "FirstTest"},
|
||||||
{Type: "output", Data: "Supplemental from first"},
|
{Type: "output", Data: "Supplemental from first"},
|
||||||
{Type: "run_test", Id: 3, Name: "ThirdTest"},
|
{Type: "run_test", Name: "ThirdTest"},
|
||||||
{Type: "output", Data: "Message from third"},
|
{Type: "output", Data: "Message from third"},
|
||||||
{Type: "end_test", Id: 3, Name: "ThirdTest", Result: "FAIL", Duration: 10 * time.Millisecond},
|
{Type: "end_test", Name: "ThirdTest", Result: "FAIL", Duration: 10 * time.Millisecond},
|
||||||
{Type: "output", Data: "\tparallel_test.go:32: ThirdTest error"},
|
{Type: "output", Data: "\tparallel_test.go:32: ThirdTest error"},
|
||||||
{Type: "end_test", Id: 1, Name: "FirstTest", Result: "FAIL", Duration: 2 * time.Second},
|
{Type: "end_test", Name: "FirstTest", Result: "FAIL", Duration: 2 * time.Second},
|
||||||
{Type: "output", Data: "\tparallel_test.go:14: FirstTest error"},
|
{Type: "output", Data: "\tparallel_test.go:14: FirstTest error"},
|
||||||
{Type: "end_test", Id: 2, Name: "SecondTest", Result: "FAIL", Duration: 1 * time.Second},
|
{Type: "end_test", Name: "SecondTest", Result: "FAIL", Duration: 1 * time.Second},
|
||||||
{Type: "output", Data: "\tparallel_test.go:23: SecondTest error"},
|
{Type: "output", Data: "\tparallel_test.go:23: SecondTest error"},
|
||||||
{Type: "status", Result: "FAIL"},
|
{Type: "status", Result: "FAIL"},
|
||||||
{Type: "output", Data: "exit status 1"},
|
{Type: "output", Data: "exit status 1"},
|
||||||
@ -321,8 +321,8 @@ var tests = []struct {
|
|||||||
}},
|
}},
|
||||||
{"21-cached",
|
{"21-cached",
|
||||||
[]Event{
|
[]Event{
|
||||||
{Type: "run_test", Id: 1, Name: "TestOne"},
|
{Type: "run_test", Name: "TestOne"},
|
||||||
{Type: "end_test", Id: 1, Name: "TestOne", Result: "PASS"},
|
{Type: "end_test", Name: "TestOne", Result: "PASS"},
|
||||||
{Type: "status", Result: "PASS"},
|
{Type: "status", Result: "PASS"},
|
||||||
{Type: "summary", Result: "ok", Name: "package/one", Data: "(cached)"},
|
{Type: "summary", Result: "ok", Name: "package/one", Data: "(cached)"},
|
||||||
}},
|
}},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user