diff --git a/README.md b/README.md index 2f0c20fc..c77f322e 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,8 @@ [](https://pkg.go.dev/golang.org/x/text) -This repository holds supplementary Go libraries for text processing, many involving Unicode. +This repository holds supplementary Go packages for text processing, +many involving Unicode. ## CLDR Versioning @@ -11,13 +12,11 @@ by your Go compiler. The `x/text` repository supports multiple versions of Unicode and will match the version of Unicode to that of the Go compiler. At the moment this is supported for Go compilers from version 1.7. -## Download/Install +## Contribute -The easiest way to install is to run `go get -u golang.org/x/text`. You can -also manually git clone the repository to `$GOPATH/src/golang.org/x/text`. +To submit changes to this repository, see http://go.dev/doc/contribute. -## Contribute -To submit changes to this repository, see http://golang.org/doc/contribute.html. +The git repository is https://go.googlesource.com/text. To generate the tables in this repository (except for the encoding tables), run go generate from this directory. By default tables are generated for the @@ -29,6 +28,7 @@ directory, which holds all files that are used as a source for generating the tables. This directory will also serve as a cache. ## Testing + Run go test ./... @@ -52,6 +52,7 @@ directory which holds all files that are used as a source for generating the tables. This directory will also serve as a cache. ## Versions + To update a Unicode version run UNICODE_VERSION=x.x.x go generate @@ -73,11 +74,8 @@ So updating to a different version may not work. The files in DATA/{iana|icu|w3|whatwg} are currently not versioned. -## Report Issues / Send Patches - -This repository uses Gerrit for code changes. To learn how to submit changes to -this repository, see https://golang.org/doc/contribute.html. +## Report Issues -The main issue tracker for the image repository is located at -https://github.com/golang/go/issues. Prefix your issue with "x/text:" in the +The main issue tracker for the text repository is located at +https://go.dev/issues. Prefix your issue with "x/text:" in the subject line, so it is easy to find. diff --git a/cases/context_test.go b/cases/context_test.go index de6ba3f8..db84ca25 100644 --- a/cases/context_test.go +++ b/cases/context_test.go @@ -9,7 +9,6 @@ import ( "testing" "unicode" - "golang.org/x/text/internal/testtext" "golang.org/x/text/language" "golang.org/x/text/transform" "golang.org/x/text/unicode/norm" @@ -213,7 +212,8 @@ func TestCCC(t *testing.T) { func TestWordBreaks(t *testing.T) { for _, tt := range breakTest { - testtext.Run(t, tt, func(t *testing.T) { + desc := norm.NFC.String(tt) + t.Run(desc, 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 6d970350..2c5cdc0b 100644 --- a/cases/icu_test.go +++ b/cases/icu_test.go @@ -11,7 +11,6 @@ import ( "strings" "testing" - "golang.org/x/text/internal/testtext" "golang.org/x/text/language" "golang.org/x/text/unicode/norm" ) @@ -83,7 +82,7 @@ func TestICUConformance(t *testing.T) { if exclude(c, tag, s) { continue } - testtext.Run(t, path.Join(c, tag, s), func(t *testing.T) { + t.Run(path.Join(c, tag, s), func(t *testing.T) { want := doICU(tag, c, s) got := doGo(tag, c, s) if norm.NFC.String(got) != norm.NFC.String(want) { diff --git a/cases/map_test.go b/cases/map_test.go index 8cfb89e5..bea6c085 100644 --- a/cases/map_test.go +++ b/cases/map_test.go @@ -205,7 +205,7 @@ func TestAlloc(t *testing.T) { // func() Caser { return Title(language.Und) }, // func() Caser { return Title(language.Und, HandleFinalSigma(false)) }, } { - testtext.Run(t, "", func(t *testing.T) { + t.Run("", func(t *testing.T) { var c Caser v := testtext.AllocsPerRun(10, func() { c = f() @@ -234,7 +234,7 @@ func testHandover(t *testing.T, c Caser, src string) { // Test handover for each substring of the prefix. for i := 0; i < pSrc; i++ { - testtext.Run(t, fmt.Sprint("interleave/", i), func(t *testing.T) { + t.Run(fmt.Sprint("interleave/", i), func(t *testing.T) { dst := make([]byte, 4*len(src)) c.Reset() nSpan, _ := c.Span([]byte(src[:i]), false) @@ -299,7 +299,7 @@ func TestHandover(t *testing.T) { "'", "n bietje", }} for _, tc := range testCases { - testtext.Run(t, tc.desc, func(t *testing.T) { + t.Run(tc.desc, func(t *testing.T) { src := tc.first + tc.second want := tc.t.String(src) tc.t.Reset() @@ -601,7 +601,7 @@ func init() { func TestShortBuffersAndOverflow(t *testing.T) { for i, tt := range bufferTests { - testtext.Run(t, tt.desc, func(t *testing.T) { + t.Run(tt.desc, func(t *testing.T) { buf := make([]byte, tt.dstSize) got := []byte{} var nSrc, nDst int @@ -827,7 +827,7 @@ func TestSpan(t *testing.T) { err: transform.ErrEndOfSpan, t: Title(language.Afrikaans), }} { - testtext.Run(t, tt.desc, func(t *testing.T) { + t.Run(tt.desc, func(t *testing.T) { for p := 0; p < len(tt.want); p += utf8.RuneLen([]rune(tt.src[p:])[0]) { tt.t.Reset() n, err := tt.t.Span([]byte(tt.src[:p]), false) @@ -901,7 +901,7 @@ func BenchmarkCasers(b *testing.B) { {"title", bytes.ToTitle}, {"upper", bytes.ToUpper}, } { - testtext.Bench(b, path.Join(s.name, "bytes", f.name), func(b *testing.B) { + b.Run(path.Join(s.name, "bytes", f.name), func(b *testing.B) { b.SetBytes(int64(len(src))) for i := 0; i < b.N; i++ { f.fn(src) @@ -921,7 +921,7 @@ func BenchmarkCasers(b *testing.B) { } { c := Caser{t.caser} dst := make([]byte, len(src)) - testtext.Bench(b, path.Join(s.name, t.name, "transform"), func(b *testing.B) { + b.Run(path.Join(s.name, t.name, "transform"), func(b *testing.B) { b.SetBytes(int64(len(src))) for i := 0; i < b.N; i++ { c.Reset() @@ -934,7 +934,7 @@ func BenchmarkCasers(b *testing.B) { continue } spanSrc := c.Bytes(src) - testtext.Bench(b, path.Join(s.name, t.name, "span"), func(b *testing.B) { + b.Run(path.Join(s.name, t.name, "span"), func(b *testing.B) { c.Reset() if n, _ := c.Span(spanSrc, true); n < len(spanSrc) { b.Fatalf("spanner is not recognizing text %q as done (at %d)", spanSrc, n) diff --git a/encoding/japanese/all_test.go b/encoding/japanese/all_test.go index a8b53e2e..88830064 100644 --- a/encoding/japanese/all_test.go +++ b/encoding/japanese/all_test.go @@ -14,6 +14,7 @@ import ( "golang.org/x/text/encoding/internal" "golang.org/x/text/encoding/internal/enctest" "golang.org/x/text/transform" + "golang.org/x/text/unicode/norm" ) func dec(e encoding.Encoding) (dir string, t transform.Transformer, err error) { @@ -127,7 +128,7 @@ func TestNonRepertoire(t *testing.T) { } for _, tc := range testCases { dir, tr, wantErr := tc.init(tc.e) - t.Run(fmt.Sprintf("%s/%v/%q", dir, tc.e, short(tc.src)), func(t *testing.T) { + t.Run(fmt.Sprintf("%s/%v/%q", dir, tc.e, shortNFC(tc.src)), func(t *testing.T) { dst := make([]byte, 100000) src := []byte(tc.src) for i := 0; i <= len(tc.src); i++ { @@ -148,7 +149,8 @@ func TestNonRepertoire(t *testing.T) { } } -func short(s string) string { +func shortNFC(s string) string { + s = norm.NFC.String(s) if len(s) <= 50 { return s } diff --git a/go.mod b/go.mod index d6375817..92379671 100644 --- a/go.mod +++ b/go.mod @@ -6,4 +6,4 @@ require golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d // tagx:ignore require golang.org/x/mod v0.17.0 // indirect; tagx:ignore -require golang.org/x/sync v0.8.0 // indirect +require golang.org/x/sync v0.9.0 // indirect diff --git a/go.sum b/go.sum index 8fe49db4..ceec7e86 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ golang.org/x/mod v0.17.0 h1:zY54UmvipHiNd+pm+m0x9KhZ9hl1/7QNMyxXbc6ICqA= golang.org/x/mod v0.17.0/go.mod h1:hTbmBsO62+eylJbnUtE2MGJUyE7QWk4xUqPFrRgJ+7c= -golang.org/x/sync v0.8.0 h1:3NFvSEYkUoMifnESzZl15y791HH1qU2xm6eCJU5ZPXQ= -golang.org/x/sync v0.8.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= +golang.org/x/sync v0.9.0 h1:fEo0HyrW1GIgZdpbhCRO0PkJajUS5H9IFUztCgEo2jQ= +golang.org/x/sync v0.9.0/go.mod h1:Czt+wKu1gCyEFDUtn0jG5QVvpJ6rzVqr5aXyt9drQfk= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d h1:vU5i/LfpvrRCpgM/VPfJLg5KjxD3E+hfT1SH+d9zLwg= golang.org/x/tools v0.21.1-0.20240508182429-e35e4ccd0d2d/go.mod h1:aiJjzUbINMkxbQROHiO6hDPo2LHcIPhhQsa9DLh0yGk= diff --git a/internal/export/idna/idna_test.go b/internal/export/idna/idna_test.go index a13b6734..543fe527 100644 --- a/internal/export/idna/idna_test.go +++ b/internal/export/idna/idna_test.go @@ -81,7 +81,7 @@ func doTest(t *testing.T, f func(string) (string, error), name, input, want, err in = strings.Replace(in, `\U`, "#", -1) name = fmt.Sprintf("%s/%s/%s", name, in, test) - testtext.Run(t, name, func(t *testing.T) { + t.Run(name, func(t *testing.T) { got, err := f(input) if err != nil { diff --git a/internal/number/number_test.go b/internal/number/number_test.go index cbc28ab4..6fe81f79 100644 --- a/internal/number/number_test.go +++ b/internal/number/number_test.go @@ -8,7 +8,6 @@ import ( "fmt" "testing" - "golang.org/x/text/internal/testtext" "golang.org/x/text/language" ) @@ -93,7 +92,7 @@ func TestFormats(t *testing.T) { {"zgh", "#,##0 %", tagToPercent}, } for _, tc := range testCases { - testtext.Run(t, tc.lang, func(t *testing.T) { + t.Run(tc.lang, func(t *testing.T) { got := formatForLang(language.MustParse(tc.lang), tc.index) want, _ := ParsePattern(tc.pattern) if *got != *want { diff --git a/internal/testtext/go1_6.go b/internal/testtext/go1_6.go deleted file mode 100644 index d7b4947e..00000000 --- a/internal/testtext/go1_6.go +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build !go1.7 - -package testtext - -import "testing" - -func Run(t *testing.T, name string, fn func(t *testing.T)) bool { - t.Logf("Running %s...", name) - fn(t) - return t.Failed() -} - -// 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 { - b.Logf("Running %s...", name) - fn(b) - return b.Failed() -} diff --git a/internal/testtext/go1_7.go b/internal/testtext/go1_7.go deleted file mode 100644 index 8153af67..00000000 --- a/internal/testtext/go1_7.go +++ /dev/null @@ -1,17 +0,0 @@ -// Copyright 2016 The Go Authors. All rights reserved. -// Use of this source code is governed by a BSD-style -// license that can be found in the LICENSE file. - -//go:build go1.7 - -package testtext - -import "testing" - -func Run(t *testing.T, name string, fn func(t *testing.T)) bool { - return t.Run(name, fn) -} - -func Bench(b *testing.B, name string, fn func(b *testing.B)) bool { - return b.Run(name, fn) -} diff --git a/language/display/display_test.go b/language/display/display_test.go index f26bace1..94a1cfce 100644 --- a/language/display/display_test.go +++ b/language/display/display_test.go @@ -11,7 +11,6 @@ import ( "testing" "unicode" - "golang.org/x/text/internal/testtext" "golang.org/x/text/language" "golang.org/x/text/message" ) @@ -40,7 +39,7 @@ func TestValues(t *testing.T) { // checkDefined checks that a value exists in a Namer. checkDefined := func(x interface{}, namers []testcase) { for _, n := range namers { - testtext.Run(t, fmt.Sprintf("%s.Name(%s)", n.kind, x), func(t *testing.T) { + t.Run(fmt.Sprintf("%s.Name(%s)", n.kind, x), func(t *testing.T) { if n.n.Name(x) == "" { // As of version 28 there is no data for az-Arab in English, // although there is useful data in other languages. @@ -449,7 +448,7 @@ func TestLanguage(t *testing.T) { {"en", "sr-Latn-ME", "Serbo-Croatian"}, // See comments in TestTag. } for _, tt := range tests { - testtext.Run(t, tt.dict+"/"+tt.tag, func(t *testing.T) { + t.Run(tt.dict+"/"+tt.tag, func(t *testing.T) { name, fmtName := splitName(tt.name) dict := language.MustParse(tt.dict) tag := language.Raw.MustParse(tt.tag) diff --git a/runes/runes_test.go b/runes/runes_test.go index 23c5bc95..b5d8c6e1 100644 --- a/runes/runes_test.go +++ b/runes/runes_test.go @@ -626,7 +626,7 @@ func doBench(b *testing.B, t Transformer) { dst := make([]byte, 2*len(bc.data)) src := []byte(bc.data) - testtext.Bench(b, bc.name+"/transform", func(b *testing.B) { + b.Run(bc.name+"/transform", func(b *testing.B) { b.SetBytes(int64(len(src))) for i := 0; i < b.N; i++ { t.Transform(dst, src, true) @@ -634,7 +634,7 @@ func doBench(b *testing.B, t Transformer) { }) src = t.Bytes(src) t.Reset() - testtext.Bench(b, bc.name+"/span", func(b *testing.B) { + b.Run(bc.name+"/span", func(b *testing.B) { b.SetBytes(int64(len(src))) for i := 0; i < b.N; i++ { t.Span(src, true) diff --git a/secure/bidirule/bench_test.go b/secure/bidirule/bench_test.go index 2db922bf..34ed5b8e 100644 --- a/secure/bidirule/bench_test.go +++ b/secure/bidirule/bench_test.go @@ -6,8 +6,6 @@ package bidirule import ( "testing" - - "golang.org/x/text/internal/testtext" ) var benchData = []struct{ name, data string }{ @@ -18,7 +16,7 @@ var benchData = []struct{ name, data string }{ func doBench(b *testing.B, fn func(b *testing.B, data string)) { for _, d := range benchData { - testtext.Bench(b, d.name, func(b *testing.B) { fn(b, d.data) }) + b.Run(d.name, func(b *testing.B) { fn(b, d.data) }) } } diff --git a/secure/bidirule/bidirule_test.go b/secure/bidirule/bidirule_test.go index e8fde338..e797eba3 100644 --- a/secure/bidirule/bidirule_test.go +++ b/secure/bidirule/bidirule_test.go @@ -8,8 +8,8 @@ import ( "fmt" "testing" - "golang.org/x/text/internal/testtext" "golang.org/x/text/unicode/bidi" + "golang.org/x/text/unicode/norm" ) const ( @@ -55,8 +55,8 @@ func init() { func doTests(t *testing.T, fn func(t *testing.T, tc ruleTest)) { for rule, cases := range testCases { for i, tc := range cases { - name := fmt.Sprintf("%d/%d:%+q:%s", rule, i, tc.in, tc.in) - testtext.Run(t, name, func(t *testing.T) { + name := fmt.Sprintf("%d/%d:%+q:%[3]s", rule, i, norm.NFC.String(tc.in)) + t.Run(name, func(t *testing.T) { fn(t, tc) }) } diff --git a/secure/precis/benchmark_test.go b/secure/precis/benchmark_test.go index 4abebd85..f8d05ae5 100644 --- a/secure/precis/benchmark_test.go +++ b/secure/precis/benchmark_test.go @@ -8,8 +8,6 @@ package precis import ( "testing" - - "golang.org/x/text/internal/testtext" ) var benchData = []struct{ name, str string }{ @@ -33,7 +31,7 @@ var benchProfiles = []struct { func doBench(b *testing.B, f func(b *testing.B, p *Profile, s string)) { for _, bp := range benchProfiles { for _, d := range benchData { - testtext.Bench(b, bp.name+"/"+d.name, func(b *testing.B) { + b.Run(bp.name+"/"+d.name, func(b *testing.B) { f(b, bp.p, d.str) }) } diff --git a/secure/precis/enforce_test.go b/secure/precis/enforce_test.go index ac2aad2c..0ced110a 100644 --- a/secure/precis/enforce_test.go +++ b/secure/precis/enforce_test.go @@ -24,7 +24,7 @@ func doTests(t *testing.T, fn func(t *testing.T, p *Profile, tc testCase)) { for _, g := range enforceTestCases { for i, tc := range g.cases { name := fmt.Sprintf("%s:%d:%+q", g.name, i, tc.input) - testtext.Run(t, name, func(t *testing.T) { + t.Run(name, func(t *testing.T) { fn(t, g.p, tc) }) } diff --git a/secure/precis/profile_test.go b/secure/precis/profile_test.go index 4edb28a7..cf922a7a 100644 --- a/secure/precis/profile_test.go +++ b/secure/precis/profile_test.go @@ -10,7 +10,6 @@ import ( "testing" "unicode" - "golang.org/x/text/internal/testtext" "golang.org/x/text/transform" ) @@ -114,7 +113,7 @@ func doCompareTests(t *testing.T, fn func(t *testing.T, p *Profile, tc compareTe for _, g := range compareTestCases { for i, tc := range g.cases { name := fmt.Sprintf("%s:%d:%+q", g.name, i, tc.a) - testtext.Run(t, name, func(t *testing.T) { + t.Run(name, func(t *testing.T) { fn(t, g.p, tc) }) } diff --git a/transform/transform_test.go b/transform/transform_test.go index 62fad2bc..1ce36c81 100644 --- a/transform/transform_test.go +++ b/transform/transform_test.go @@ -642,7 +642,7 @@ var testCases = []testCase{ func TestReader(t *testing.T) { for _, tc := range testCases { - testtext.Run(t, tc.desc, func(t *testing.T) { + t.Run(tc.desc, func(t *testing.T) { r := NewReader(strings.NewReader(tc.src), tc.t) // Differently sized dst and src buffers are not part of the // exported API. We override them manually. @@ -665,7 +665,7 @@ func TestWriter(t *testing.T) { sizes = []int{tc.ioSize} } for _, sz := range sizes { - testtext.Run(t, fmt.Sprintf("%s/%d", tc.desc, sz), func(t *testing.T) { + t.Run(fmt.Sprintf("%s/%d", tc.desc, sz), func(t *testing.T) { bb := &bytes.Buffer{} w := NewWriter(bb, tc.t) // Differently sized dst and src buffers are not part of the @@ -1149,7 +1149,7 @@ func testString(t *testing.T, f func(Transformer, string) (string, int, error)) // The result string will be different. continue } - testtext.Run(t, tt.desc, func(t *testing.T) { + t.Run(tt.desc, func(t *testing.T) { got, n, err := f(tt.t, tt.src) if tt.wantErr != err { t.Errorf("error: got %v; want %v", err, tt.wantErr) @@ -1193,7 +1193,7 @@ func TestAppend(t *testing.T) { } func TestString(t *testing.T) { - testtext.Run(t, "transform", func(t *testing.T) { testString(t, String) }) + t.Run("transform", func(t *testing.T) { testString(t, String) }) // Overrun the internal destination buffer. for i, s := range []string{ @@ -1211,7 +1211,7 @@ func TestString(t *testing.T) { aaa[:1*initialBufSize+0] + "A", aaa[:1*initialBufSize+1] + "A", } { - testtext.Run(t, fmt.Sprint("dst buffer test using lower/", i), func(t *testing.T) { + t.Run(fmt.Sprint("dst buffer test using lower/", i), func(t *testing.T) { got, _, _ := String(lowerCaseASCII{}, s) if want := strings.ToLower(s); got != want { t.Errorf("got %s (%d); want %s (%d)", got, len(got), want, len(want)) @@ -1228,7 +1228,7 @@ func TestString(t *testing.T) { aaa[:2*initialBufSize+0], aaa[:2*initialBufSize+1], } { - testtext.Run(t, fmt.Sprint("src buffer test using rleEncode/", i), func(t *testing.T) { + t.Run(fmt.Sprint("src buffer test using rleEncode/", i), func(t *testing.T) { got, _, _ := String(rleEncode{}, s) if want := fmt.Sprintf("%da", len(s)); got != want { t.Errorf("got %s (%d); want %s (%d)", got, len(got), want, len(want)) @@ -1246,7 +1246,7 @@ func TestString(t *testing.T) { aaa[:initialBufSize+1], aaa[:10*initialBufSize], } { - testtext.Run(t, fmt.Sprint("alloc/", i), func(t *testing.T) { + t.Run(fmt.Sprint("alloc/", i), func(t *testing.T) { if n := testtext.AllocsPerRun(5, func() { String(&lowerCaseASCIILookahead{}, s) }); n > 1 { t.Errorf("#allocs was %f; want 1", n) } diff --git a/unicode/cldr/collate_test.go b/unicode/cldr/collate_test.go index f6721639..e5237416 100644 --- a/unicode/cldr/collate_test.go +++ b/unicode/cldr/collate_test.go @@ -164,13 +164,13 @@ func TestRuleProcessor(t *testing.T) { }, { desc: "err empty anchor", - in: " & ", - out: "E:1: missing string", + in: " & ", + out: "E:1: missing string", }, { desc: "err anchor invalid special 1", - in: " & [ foo ", - out: "E:1: unmatched bracket", + in: " & [ foo ", + out: "E:1: unmatched bracket", }, { desc: "err anchor invalid special 2", diff --git a/unicode/norm/normalize_test.go b/unicode/norm/normalize_test.go index 678ca403..855e7b59 100644 --- a/unicode/norm/normalize_test.go +++ b/unicode/norm/normalize_test.go @@ -18,7 +18,6 @@ import ( "testing" "unicode/utf8" - "golang.org/x/text/internal/testtext" "golang.org/x/text/transform" ) @@ -467,7 +466,7 @@ var quickSpanNFCTests = []spanTest{ func runSpanTests(t *testing.T, name string, f Form, testCases []spanTest) { for i, tc := range testCases { s := fmt.Sprintf("Bytes/%s/%d=%+q/atEOF=%v", name, i, pc(tc.input), tc.atEOF) - ok := testtext.Run(t, s, func(t *testing.T) { + ok := t.Run(s, func(t *testing.T) { n, err := f.Span([]byte(tc.input), tc.atEOF) if n != tc.n || err != tc.err { t.Errorf("\n got %d, %v;\nwant %d, %v", n, err, tc.n, tc.err) @@ -477,7 +476,7 @@ func runSpanTests(t *testing.T, name string, f Form, testCases []spanTest) { continue // Don't do the String variant if the Bytes variant failed. } s = fmt.Sprintf("String/%s/%d=%+q/atEOF=%v", name, i, pc(tc.input), tc.atEOF) - testtext.Run(t, s, func(t *testing.T) { + t.Run(s, func(t *testing.T) { n, err := f.SpanString(tc.input, tc.atEOF) if n != tc.n || err != tc.err { t.Errorf("\n got %d, %v;\nwant %d, %v", n, err, tc.n, tc.err) diff --git a/unicode/norm/transform_test.go b/unicode/norm/transform_test.go index 2690fc36..9ff30d48 100644 --- a/unicode/norm/transform_test.go +++ b/unicode/norm/transform_test.go @@ -69,7 +69,7 @@ func TestTransform(t *testing.T) { } b := make([]byte, 100) for i, tt := range tests { - t.Run(fmt.Sprintf("%d:%s", i, tt.in), func(t *testing.T) { + t.Run(fmt.Sprint(i), func(t *testing.T) { nDst, _, err := tt.f.Transform(b[:tt.dstSize], []byte(tt.in), tt.eof) out := string(b[:nDst]) if out != tt.out || err != tt.err { diff --git a/width/transform_test.go b/width/transform_test.go index f9122d6d..f14c7c66 100644 --- a/width/transform_test.go +++ b/width/transform_test.go @@ -65,7 +65,7 @@ type transformTest struct { } func (tc *transformTest) doTest(t *testing.T, tr Transformer) { - testtext.Run(t, tc.desc, func(t *testing.T) { + t.Run(tc.desc, func(t *testing.T) { b := make([]byte, tc.nBuf) nDst, nSrc, err := tr.Transform(b, []byte(tc.src), tc.atEOF) if got := string(b[:nDst]); got != tc.dst[:nDst] {