mirror of
https://github.com/golang/go
synced 2024-10-01 16:08:33 -06:00
testing: fixed bug introduced by CL 21504
This broke T.Run Change-Id: I12c8fe3612f3fa2caa83049c1c7003056daf2b0c Reviewed-on: https://go-review.googlesource.com/21600 Run-TryBot: Marcel van Lohuizen <mpvl@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
parent
d70cb46f0f
commit
63cea5ac2b
@ -178,6 +178,22 @@ func TestTRun(t *T) {
|
|||||||
=== RUN skipping without message, chatty
|
=== RUN skipping without message, chatty
|
||||||
--- SKIP: skipping without message, chatty (0.00s)`,
|
--- SKIP: skipping without message, chatty (0.00s)`,
|
||||||
f: func(t *T) { t.SkipNow() },
|
f: func(t *T) { t.SkipNow() },
|
||||||
|
}, {
|
||||||
|
desc: "chatty with recursion",
|
||||||
|
ok: true,
|
||||||
|
chatty: true,
|
||||||
|
output: `
|
||||||
|
=== RUN chatty with recursion
|
||||||
|
=== RUN chatty with recursion/#00
|
||||||
|
=== RUN chatty with recursion/#00/#00
|
||||||
|
--- PASS: chatty with recursion (0.00s)
|
||||||
|
--- PASS: chatty with recursion/#00 (0.00s)
|
||||||
|
--- PASS: chatty with recursion/#00/#00 (0.00s)`,
|
||||||
|
f: func(t *T) {
|
||||||
|
t.Run("", func(t *T) {
|
||||||
|
t.Run("", func(t *T) {})
|
||||||
|
})
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
desc: "skipping without message, not chatty",
|
desc: "skipping without message, not chatty",
|
||||||
ok: true,
|
ok: true,
|
||||||
@ -435,6 +451,14 @@ func TestBRun(t *T) {
|
|||||||
--- SKIP: root
|
--- SKIP: root
|
||||||
sub_test.go:: skipping`,
|
sub_test.go:: skipping`,
|
||||||
f: func(b *B) { b.Skip("skipping") },
|
f: func(b *B) { b.Skip("skipping") },
|
||||||
|
}, {
|
||||||
|
desc: "chatty with recursion",
|
||||||
|
chatty: true,
|
||||||
|
f: func(b *B) {
|
||||||
|
b.Run("", func(b *B) {
|
||||||
|
b.Run("", func(b *B) {})
|
||||||
|
})
|
||||||
|
},
|
||||||
}, {
|
}, {
|
||||||
desc: "skipping without message, not chatty",
|
desc: "skipping without message, not chatty",
|
||||||
f: func(b *B) { b.SkipNow() },
|
f: func(b *B) { b.SkipNow() },
|
||||||
|
@ -571,7 +571,7 @@ func (t *T) Run(name string, f func(t *T)) bool {
|
|||||||
if t.chatty {
|
if t.chatty {
|
||||||
// Print directly to root's io.Writer so there is no delay.
|
// Print directly to root's io.Writer so there is no delay.
|
||||||
root := t.parent
|
root := t.parent
|
||||||
for ; root.parent != nil; root = t.parent {
|
for ; root.parent != nil; root = root.parent {
|
||||||
}
|
}
|
||||||
fmt.Fprintf(root.w, "=== RUN %s\n", t.name)
|
fmt.Fprintf(root.w, "=== RUN %s\n", t.name)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user