cases: fix 1.6 build breakages also updated build failure in 1.6 Bench wrapper TBR Change-Id: I46d13d5ee2083e46234f29548af6608bcc39ade4 Reviewed-on: https://go-review.googlesource.com/29181 Run-TryBot: Marcel van Lohuizen <mpvl@golang.org> Reviewed-by: Marcel van Lohuizen <mpvl@golang.org>
diff --git a/cases/context_test.go b/cases/context_test.go index 593a70f..f590878 100644 --- a/cases/context_test.go +++ b/cases/context_test.go
@@ -9,6 +9,7 @@ "testing" "unicode" + "golang.org/x/text/internal/testtext" "golang.org/x/text/language" "golang.org/x/text/transform" "golang.org/x/text/unicode/norm" @@ -212,7 +213,7 @@ func TestWordBreaks(t *testing.T) { for _, tt := range breakTest { - t.Run(tt, func(t *testing.T) { + testtext.Run(t, tt, func(t *testing.T) { parts := strings.Split(tt, "|") want := "" for _, s := range parts {
diff --git a/cases/icu_test.go b/cases/icu_test.go index b9399f5..7fc3f7f 100644 --- a/cases/icu_test.go +++ b/cases/icu_test.go
@@ -11,6 +11,7 @@ "strings" "testing" + "golang.org/x/text/internal/testtext" "golang.org/x/text/language" ) @@ -81,7 +82,7 @@ if exclude(tag, s) { continue } - t.Run(path.Join(c, tag, s), func(t *testing.T) { + testtext.Run(path.Join(c, tag, s), func(t *testing.T) { want := doICU(tag, c, s) got := doGo(tag, c, s) if got != want {
diff --git a/cases/map_test.go b/cases/map_test.go index bcfc72c..2f4f40e 100644 --- a/cases/map_test.go +++ b/cases/map_test.go
@@ -233,7 +233,7 @@ // Test handover for each substring of the prefix. for i := 0; i < pSrc; i++ { - t.Run(fmt.Sprint("interleave/", i), func(t *testing.T) { + testtext.Run(t, fmt.Sprint("interleave/", i), func(t *testing.T) { dst := make([]byte, 4*len(src)) c.Reset() nSpan, _ := c.Span([]byte(src[:i]), false) @@ -298,7 +298,7 @@ "'", "n bietje", }} for _, tc := range testCases { - t.Run(tc.desc, func(t *testing.T) { + testtext.Run(t, tc.desc, func(t *testing.T) { src := tc.first + tc.second want := tc.t.String(src) tc.t.Reset()
diff --git a/internal/testtext/go1_6.go b/internal/testtext/go1_6.go index 17af5e3..7b23847 100644 --- a/internal/testtext/go1_6.go +++ b/internal/testtext/go1_6.go
@@ -17,7 +17,7 @@ // Bench runs the given benchmark function. This pre-1.7 implementation renders // the measurement useless, but allows the code to be compiled at least. func Bench(b *testing.B, name string, fn func(b *testing.B)) bool { - t.Logf("Running %s...", name) - fn(t) - return t.Failed() + b.Logf("Running %s...", name) + fn(b) + return b.Failed() }