mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-05-20 10:54:28 -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.
|
||||
func (p *Parser) report(events []Event) gtr.Report {
|
||||
rb := newReportBuilder()
|
||||
rb.PackageName = p.packageName
|
||||
rb.packageName = p.packageName
|
||||
if p.timestampFunc != nil {
|
||||
rb.TimestampFunc = p.timestampFunc
|
||||
rb.timestampFunc = p.timestampFunc
|
||||
}
|
||||
for _, ev := range events {
|
||||
switch ev.Type {
|
||||
|
@ -27,9 +27,9 @@ type reportBuilder struct {
|
||||
output []string // output that does not belong to any test
|
||||
coverage float64 // coverage percentage
|
||||
|
||||
// default values
|
||||
PackageName string
|
||||
TimestampFunc func() time.Time
|
||||
// options
|
||||
packageName string
|
||||
timestampFunc func() time.Time
|
||||
}
|
||||
|
||||
// newReportBuilder creates a new reportBuilder.
|
||||
@ -40,7 +40,7 @@ func newReportBuilder() *reportBuilder {
|
||||
buildErrors: make(map[int]gtr.Error),
|
||||
runErrors: make(map[int]gtr.Error),
|
||||
nextID: 1,
|
||||
TimestampFunc: time.Now,
|
||||
timestampFunc: time.Now,
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,7 +57,7 @@ func (b *reportBuilder) newID() int {
|
||||
// benchmark did not end with a summary.
|
||||
func (b *reportBuilder) flush() {
|
||||
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,
|
||||
}
|
||||
|
||||
if b.TimestampFunc != nil {
|
||||
pkg.Timestamp = b.TimestampFunc()
|
||||
if b.timestampFunc != nil {
|
||||
pkg.Timestamp = b.timestampFunc()
|
||||
}
|
||||
|
||||
// Build errors are treated somewhat differently. Rather than having a
|
||||
|
Loading…
x
Reference in New Issue
Block a user