mirror of
https://github.com/jstemmer/go-junit-report.git
synced 2025-07-05 13:32:54 -05:00
junit: Use the standard duration formatting for benchmark durations
Benchmark durations were originally formatted with higher precision because they contained just the NsPerOp field. Now that we're approximating the total duration they are more accurate and don't need as many decimals.
This commit is contained in:
@ -235,7 +235,7 @@ func createTestcaseForBenchmark(pkgName string, bm gtr.Benchmark) Testcase {
|
||||
tc := Testcase{
|
||||
Classname: pkgName,
|
||||
Name: bm.Name,
|
||||
Time: formatBenchmarkTime(bm.ApproximateDuration()),
|
||||
Time: formatDuration(bm.ApproximateDuration()),
|
||||
}
|
||||
|
||||
if bm.Result == gtr.Fail {
|
||||
@ -258,12 +258,6 @@ func formatDuration(d time.Duration) string {
|
||||
return fmt.Sprintf("%.3f", d.Seconds())
|
||||
}
|
||||
|
||||
// formatBenchmarkTime returns the JUnit string representation of the given
|
||||
// benchmark time.
|
||||
func formatBenchmarkTime(d time.Duration) string {
|
||||
return fmt.Sprintf("%.9f", d.Seconds())
|
||||
}
|
||||
|
||||
// formatOutput combines the lines from the given output into a single string.
|
||||
func formatOutput(output []string, indent int) string {
|
||||
return strings.Join(output, "\n")
|
||||
|
Reference in New Issue
Block a user