mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-05-20 19:04:29 -05:00
parser/gotest: Make reportBuilder options private
This commit is contained in:
parent
ae7e71c599
commit
f97910c4b9
@ -88,9 +88,9 @@ func (p *Parser) Parse(r io.Reader) (gtr.Report, error) {
|
|||||||
// report generates a gtr.Report from the given list of events.
|
// report generates a gtr.Report from the given list of events.
|
||||||
func (p *Parser) report(events []Event) gtr.Report {
|
func (p *Parser) report(events []Event) gtr.Report {
|
||||||
rb := newReportBuilder()
|
rb := newReportBuilder()
|
||||||
rb.PackageName = p.packageName
|
rb.packageName = p.packageName
|
||||||
if p.timestampFunc != nil {
|
if p.timestampFunc != nil {
|
||||||
rb.TimestampFunc = p.timestampFunc
|
rb.timestampFunc = p.timestampFunc
|
||||||
}
|
}
|
||||||
for _, ev := range events {
|
for _, ev := range events {
|
||||||
switch ev.Type {
|
switch ev.Type {
|
||||||
|
@ -27,9 +27,9 @@ type reportBuilder struct {
|
|||||||
output []string // output that does not belong to any test
|
output []string // output that does not belong to any test
|
||||||
coverage float64 // coverage percentage
|
coverage float64 // coverage percentage
|
||||||
|
|
||||||
// default values
|
// options
|
||||||
PackageName string
|
packageName string
|
||||||
TimestampFunc func() time.Time
|
timestampFunc func() time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
// newReportBuilder creates a new reportBuilder.
|
// newReportBuilder creates a new reportBuilder.
|
||||||
@ -40,7 +40,7 @@ func newReportBuilder() *reportBuilder {
|
|||||||
buildErrors: make(map[int]gtr.Error),
|
buildErrors: make(map[int]gtr.Error),
|
||||||
runErrors: make(map[int]gtr.Error),
|
runErrors: make(map[int]gtr.Error),
|
||||||
nextID: 1,
|
nextID: 1,
|
||||||
TimestampFunc: time.Now,
|
timestampFunc: time.Now,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +57,7 @@ func (b *reportBuilder) newID() int {
|
|||||||
// benchmark did not end with a summary.
|
// benchmark did not end with a summary.
|
||||||
func (b *reportBuilder) flush() {
|
func (b *reportBuilder) flush() {
|
||||||
if len(b.tests) > 0 || len(b.benchmarks) > 0 {
|
if len(b.tests) > 0 || len(b.benchmarks) > 0 {
|
||||||
b.CreatePackage(b.PackageName, "", 0, "")
|
b.CreatePackage(b.packageName, "", 0, "")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -175,8 +175,8 @@ func (b *reportBuilder) CreatePackage(name, result string, duration time.Duratio
|
|||||||
Duration: duration,
|
Duration: duration,
|
||||||
}
|
}
|
||||||
|
|
||||||
if b.TimestampFunc != nil {
|
if b.timestampFunc != nil {
|
||||||
pkg.Timestamp = b.TimestampFunc()
|
pkg.Timestamp = b.timestampFunc()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Build errors are treated somewhat differently. Rather than having a
|
// Build errors are treated somewhat differently. Rather than having a
|
||||||
|
Loading…
x
Reference in New Issue
Block a user