diff --git a/go-junit-report_test.go b/go-junit-report_test.go
index a6023ca..cdc0281 100644
--- a/go-junit-report_test.go
+++ b/go-junit-report_test.go
@@ -1174,6 +1174,44 @@ var testCases = []TestCase{
},
},
},
+ {
+ name: "28-bench-1cpu.txt",
+ reportName: "28-report.xml",
+ report: &parser.Report{
+ Packages: []parser.Package{
+ {
+ Name: "single/cpu",
+ Duration: 9467 * time.Millisecond,
+ Time: 9467,
+ Benchmarks: []*parser.Benchmark{
+ {
+ Name: "BenchmarkRing",
+ Duration: 74 * time.Nanosecond,
+ },
+ },
+ },
+ },
+ },
+ },
+ {
+ name: "29-bench-16cpu.txt",
+ reportName: "29-report.xml",
+ report: &parser.Report{
+ Packages: []parser.Package{
+ {
+ Name: "sixteen/cpu",
+ Duration: 1522 * time.Millisecond,
+ Time: 1522,
+ Benchmarks: []*parser.Benchmark{
+ {
+ Name: "BenchmarkRingaround",
+ Duration: 13571 * time.Nanosecond,
+ },
+ },
+ },
+ },
+ },
+ },
}
func TestParser(t *testing.T) {
diff --git a/parser/parser.go b/parser/parser.go
index 585ff2e..b095b7c 100644
--- a/parser/parser.go
+++ b/parser/parser.go
@@ -62,7 +62,7 @@ var (
regexCoverage = regexp.MustCompile(`^coverage:\s+(\d+\.\d+)%\s+of\s+statements(?:\sin\s.+)?$`)
regexResult = regexp.MustCompile(`^(ok|FAIL)\s+([^ ]+)\s+(?:(\d+\.\d+)s|\(cached\)|(\[\w+ failed]))(?:\s+coverage:\s+(\d+\.\d+)%\sof\sstatements(?:\sin\s.+)?)?$`)
// regexBenchmark captures 3-5 groups: benchmark name, number of times ran, ns/op (with or without decimal), B/op (optional), and allocs/op (optional).
- regexBenchmark = regexp.MustCompile(`^(Benchmark[^ ]+)-\d\s+(\d+)\s+(\d+|\d+\.\d+)\sns/op(?:\s+(\d+)\sB/op)?(?:\s+(\d+)\sallocs/op)?`)
+ regexBenchmark = regexp.MustCompile(`^(Benchmark[^ -]+)(?:-\d+\s+|\s+)(\d+)\s+(\d+|\d+\.\d+)\sns/op(?:\s+(\d+)\sB/op)?(?:\s+(\d+)\sallocs/op)?`)
regexOutput = regexp.MustCompile(`( )*\t(.*)`)
regexSummary = regexp.MustCompile(`^(PASS|FAIL|SKIP)$`)
)
diff --git a/testdata/28-bench-1cpu.txt b/testdata/28-bench-1cpu.txt
new file mode 100644
index 0000000..db0f002
--- /dev/null
+++ b/testdata/28-bench-1cpu.txt
@@ -0,0 +1,4 @@
+pkg: single/cpu
+BenchmarkRing 20000000 74.2 ns/op
+PASS
+ok single/cpu 9.467s
\ No newline at end of file
diff --git a/testdata/28-report.xml b/testdata/28-report.xml
new file mode 100644
index 0000000..bcd829a
--- /dev/null
+++ b/testdata/28-report.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
diff --git a/testdata/29-bench-16cpu.txt b/testdata/29-bench-16cpu.txt
new file mode 100644
index 0000000..aadd76c
--- /dev/null
+++ b/testdata/29-bench-16cpu.txt
@@ -0,0 +1,4 @@
+pkg: sixteen/cpu
+BenchmarkRingaround-16 100000 13571 ns/op
+PASS
+ok sixteen/cpu 1.522s
\ No newline at end of file
diff --git a/testdata/29-report.xml b/testdata/29-report.xml
new file mode 100644
index 0000000..fa34ee8
--- /dev/null
+++ b/testdata/29-report.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+