mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-04-05 05:00:15 -05:00
internal: make timestampFunc private
This commit is contained in:
parent
b5d2695c26
commit
dcbbd9fb22
@ -25,10 +25,12 @@ type Config struct {
|
||||
PackageName string
|
||||
SkipXMLHeader bool
|
||||
Properties map[string]string
|
||||
TimestampFunc func() time.Time
|
||||
|
||||
// For debugging
|
||||
PrintEvents bool
|
||||
|
||||
// For testing
|
||||
timestampFunc func() time.Time
|
||||
}
|
||||
|
||||
// Run runs the go-junit-report command and returns the generated report.
|
||||
@ -38,12 +40,12 @@ func (c Config) Run(input io.Reader, output io.Writer) (*gtr.Report, error) {
|
||||
case "gotest":
|
||||
p = gotest.NewParser(
|
||||
gotest.PackageName(c.PackageName),
|
||||
gotest.TimestampFunc(c.TimestampFunc),
|
||||
gotest.TimestampFunc(c.timestampFunc),
|
||||
)
|
||||
case "gojson":
|
||||
p = gotest.NewJSONParser(
|
||||
gotest.PackageName(c.PackageName),
|
||||
gotest.TimestampFunc(c.TimestampFunc),
|
||||
gotest.TimestampFunc(c.timestampFunc),
|
||||
)
|
||||
default:
|
||||
return nil, fmt.Errorf("invalid parser: %s", c.Parser)
|
||||
|
@ -70,7 +70,7 @@ func testRun(inputFile, reportFile string, config Config, t *testing.T) {
|
||||
}
|
||||
config.Hostname = "hostname"
|
||||
config.Properties = map[string]string{"go.version": "1.0"}
|
||||
config.TimestampFunc = func() time.Time {
|
||||
config.timestampFunc = func() time.Time {
|
||||
return time.Date(2022, 1, 1, 0, 0, 0, 0, time.UTC)
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user