]> Cypherpunks repositories - gostls13.git/commitdiff
testing: use a pattern to match the elapsed time in TestTRun
authorMateusz Poliwczak <mpoliwczak34@gmail.com>
Tue, 20 May 2025 07:46:53 +0000 (09:46 +0200)
committerGopher Robot <gobot@golang.org>
Tue, 20 May 2025 14:37:42 +0000 (07:37 -0700)
Fixes #73723
Fixes #73737
Fixes #73739

Change-Id: I1ebd3614614285c3e660d48241389bb0f896be23
Reviewed-on: https://go-review.googlesource.com/c/go/+/674355
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Auto-Submit: Alan Donovan <adonovan@google.com>
Reviewed-by: Keith Randall <khr@google.com>
Reviewed-by: Alan Donovan <adonovan@google.com>
src/testing/sub_test.go

index d3d383427d40a8a0c0562a71fd0badefe319d376..bb5586d9fcb5268c0c25c712f4989a9a5570b11a 100644 (file)
@@ -505,8 +505,8 @@ func TestTRun(t *T) {
                desc: "buffered output gets flushed at test end",
                ok:   false,
                output: `
---- FAIL: buffered output gets flushed at test end (0.00s)
-    --- FAIL: buffered output gets flushed at test end/#00 (0.00s)
+--- FAIL: buffered output gets flushed at test end (N.NNs)
+    --- FAIL: buffered output gets flushed at test end/#00 (N.NNs)
         a
         b`,
                f: func(t *T) {
@@ -526,8 +526,8 @@ func TestTRun(t *T) {
 === RUN   output with chatty/#00
     a
     b
---- PASS: output with chatty (0.00s)
-    --- PASS: output with chatty/#00 (0.00s)`,
+--- PASS: output with chatty (N.NNs)
+    --- PASS: output with chatty/#00 (N.NNs)`,
                f: func(t *T) {
                        t.Run("", func(t *T) {
                                o := t.Output()
@@ -545,9 +545,9 @@ func TestTRun(t *T) {
 ^V=== RUN   output with chatty and json/#00
     a
     b
-^V--- PASS: output with chatty and json/#00 (0.00s)
+^V--- PASS: output with chatty and json/#00 (N.NNs)
 ^V=== NAME  output with chatty and json
-^V--- PASS: output with chatty and json (0.00s)
+^V--- PASS: output with chatty and json (N.NNs)
 ^V=== NAME
 `,
                f: func(t *T) {
@@ -583,8 +583,8 @@ func TestTRun(t *T) {
                desc: "newline between buffered log and log",
                ok:   false,
                output: `
---- FAIL: newline between buffered log and log (0.00s)
-    --- FAIL: newline between buffered log and log/#00 (0.00s)
+--- FAIL: newline between buffered log and log (N.NNs)
+    --- FAIL: newline between buffered log and log/#00 (N.NNs)
         buffered message
         sub_test.go:NNN: log`,
                f: func(t *T) {