Commit 594cddd6 authored by Andrew Gerrand's avatar Andrew Gerrand

testing: add Name method to *T and *B

Fixes #17231

Change-Id: I0d6007ab504f2277cb6affc9e2050157a6ad4d5e
Reviewed-on: https://go-review.googlesource.com/29970Reviewed-by: default avatarBrad Fitzpatrick <bradfitz@golang.org>
Reviewed-by: default avatarMinux Ma <minux@golang.org>
Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent db82cf4e
...@@ -372,6 +372,7 @@ type TB interface { ...@@ -372,6 +372,7 @@ type TB interface {
Fatalf(format string, args ...interface{}) Fatalf(format string, args ...interface{})
Log(args ...interface{}) Log(args ...interface{})
Logf(format string, args ...interface{}) Logf(format string, args ...interface{})
Name() string
Skip(args ...interface{}) Skip(args ...interface{})
SkipNow() SkipNow()
Skipf(format string, args ...interface{}) Skipf(format string, args ...interface{})
...@@ -404,6 +405,11 @@ type T struct { ...@@ -404,6 +405,11 @@ type T struct {
func (c *common) private() {} func (c *common) private() {}
// Name returns the name of the running test or benchmark.
func (c *common) Name() string {
return c.name
}
// Fail marks the function as having failed but continues execution. // Fail marks the function as having failed but continues execution.
func (c *common) Fail() { func (c *common) Fail() {
if c.parent != nil { if c.parent != nil {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment