From: fangguizhen <1297394526@qq.com> Date: Thu, 19 Jan 2023 03:12:12 +0000 (+0000) Subject: bytes, strings: rename field in CutSuffix tests X-Git-Tag: go1.21rc1~1874 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=e590afcf2c2d046b1a4b6a11986a8e38a2b93ed7;p=gostls13.git bytes, strings: rename field in CutSuffix tests Change-Id: I63181f6540fc1bfcfc988a16bf9fafbd3575cfdf GitHub-Last-Rev: d90528730a92a087866c1bfc227a0a0bf1cdffbe GitHub-Pull-Request: golang/go#57909 Reviewed-on: https://go-review.googlesource.com/c/go/+/462284 Reviewed-by: Ian Lance Taylor Run-TryBot: Ian Lance Taylor Auto-Submit: Ian Lance Taylor TryBot-Result: Gopher Robot Run-TryBot: Ian Lance Taylor Reviewed-by: Cherry Mui --- diff --git a/src/bytes/bytes_test.go b/src/bytes/bytes_test.go index f58f18c461..fc2824485a 100644 --- a/src/bytes/bytes_test.go +++ b/src/bytes/bytes_test.go @@ -1728,7 +1728,7 @@ func TestCutPrefix(t *testing.T) { var cutSuffixTests = []struct { s, sep string - after string + before string found bool }{ {"abc", "bc", "a", true}, @@ -1741,8 +1741,8 @@ var cutSuffixTests = []struct { func TestCutSuffix(t *testing.T) { for _, tt := range cutSuffixTests { - if after, found := CutSuffix([]byte(tt.s), []byte(tt.sep)); string(after) != tt.after || found != tt.found { - t.Errorf("CutSuffix(%q, %q) = %q, %v, want %q, %v", tt.s, tt.sep, after, found, tt.after, tt.found) + if before, found := CutSuffix([]byte(tt.s), []byte(tt.sep)); string(before) != tt.before || found != tt.found { + t.Errorf("CutSuffix(%q, %q) = %q, %v, want %q, %v", tt.s, tt.sep, before, found, tt.before, tt.found) } } } diff --git a/src/strings/strings_test.go b/src/strings/strings_test.go index 3991d12751..5143ec86c9 100644 --- a/src/strings/strings_test.go +++ b/src/strings/strings_test.go @@ -1668,7 +1668,7 @@ func TestCutPrefix(t *testing.T) { var cutSuffixTests = []struct { s, sep string - after string + before string found bool }{ {"abc", "bc", "a", true}, @@ -1681,8 +1681,8 @@ var cutSuffixTests = []struct { func TestCutSuffix(t *testing.T) { for _, tt := range cutSuffixTests { - if after, found := CutSuffix(tt.s, tt.sep); after != tt.after || found != tt.found { - t.Errorf("CutSuffix(%q, %q) = %q, %v, want %q, %v", tt.s, tt.sep, after, found, tt.after, tt.found) + if before, found := CutSuffix(tt.s, tt.sep); before != tt.before || found != tt.found { + t.Errorf("CutSuffix(%q, %q) = %q, %v, want %q, %v", tt.s, tt.sep, before, found, tt.before, tt.found) } } }