mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-07-07 14:25:44 -05:00
gtr,parser/gotest: move Event and building a report to parser/gotest
The Parse method now directly returns a report, rather than a list of events that then need to be converted into a report. As part of this change, the Event struct has also been moved to the gotest package. It's now the responsibility of the parser to construct a gtr.Report.
This commit is contained in:
@ -26,18 +26,17 @@ type ReportBuilder struct {
|
||||
coverage float64 // coverage percentage
|
||||
|
||||
// default values
|
||||
packageName string
|
||||
PackageName string
|
||||
}
|
||||
|
||||
// NewReportBuilder creates a new ReportBuilder.
|
||||
func NewReportBuilder(packageName string) *ReportBuilder {
|
||||
func NewReportBuilder() *ReportBuilder {
|
||||
return &ReportBuilder{
|
||||
tests: make(map[int]Test),
|
||||
benchmarks: make(map[int]Benchmark),
|
||||
buildErrors: make(map[int]Error),
|
||||
runErrors: make(map[int]Error),
|
||||
nextId: 1,
|
||||
packageName: packageName,
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,7 +53,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, "")
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user