aboutsummaryrefslogtreecommitdiff
path: root/internal/stdlib
diff options
context:
space:
mode:
authorJulie Qiu <julie@golang.org>2020-11-19 23:09:05 -0500
committerJulie Qiu <julie@golang.org>2020-11-20 17:06:53 +0000
commitff4efb1a4d232c4ac063ff38f5985661ea97b37e (patch)
tree0dfc86951e16ff791f5f7d5beba7b461b60a44ff /internal/stdlib
parent6657ef22c5588415c202445532bd23498217f364 (diff)
downloadgo-x-pkgsite-ff4efb1a4d232c4ac063ff38f5985661ea97b37e.tar.xz
internal: rename tc to test
The variable tc is renamed to test when used to refer to a test case, for consistency throughout the rest of the codebase, which uses the variable test in most cases. Change-Id: I88a87aa020928af98e8579a299f3111718dfa044 Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/271809 Run-TryBot: Julie Qiu <julie@golang.org> TryBot-Result: kokoro <noreply+kokoro@google.com> Reviewed-by: Jonathan Amsterdam <jba@google.com> Trust: Julie Qiu <julie@golang.org>
Diffstat (limited to 'internal/stdlib')
-rw-r--r--internal/stdlib/stdlib_test.go22
-rw-r--r--internal/stdlib/testdata/v1.12.5/src/context/context_test.go8
2 files changed, 15 insertions, 15 deletions
diff --git a/internal/stdlib/stdlib_test.go b/internal/stdlib/stdlib_test.go
index 77786166..fec1e735 100644
--- a/internal/stdlib/stdlib_test.go
+++ b/internal/stdlib/stdlib_test.go
@@ -14,7 +14,7 @@ import (
)
func TestTagForVersion(t *testing.T) {
- for _, tc := range []struct {
+ for _, test := range []struct {
name string
version string
want string
@@ -76,14 +76,14 @@ func TestTagForVersion(t *testing.T) {
wantErr: true,
},
} {
- t.Run(tc.name, func(t *testing.T) {
- got, err := TagForVersion(tc.version)
- if (err != nil) != tc.wantErr {
- t.Errorf("TagForVersion(%q) = %q, %v, wantErr %v", tc.version, got, err, tc.wantErr)
+ t.Run(test.name, func(t *testing.T) {
+ got, err := TagForVersion(test.version)
+ if (err != nil) != test.wantErr {
+ t.Errorf("TagForVersion(%q) = %q, %v, wantErr %v", test.version, got, err, test.wantErr)
return
}
- if got != tc.want {
- t.Errorf("TagForVersion(%q) = %q, %v, wanted %q, %v", tc.version, got, err, tc.want, nil)
+ if got != test.want {
+ t.Errorf("TagForVersion(%q) = %q, %v, wanted %q, %v", test.version, got, err, test.want, nil)
}
})
}
@@ -216,7 +216,7 @@ func TestVersions(t *testing.T) {
}
func TestVersionForTag(t *testing.T) {
- for _, tc := range []struct {
+ for _, test := range []struct {
in, want string
}{
{"", ""},
@@ -231,9 +231,9 @@ func TestVersionForTag(t *testing.T) {
{"weekly.2012-02-14", ""},
{"latest", "latest"},
} {
- got := VersionForTag(tc.in)
- if got != tc.want {
- t.Errorf("VersionForTag(%q) = %q, want %q", tc.in, got, tc.want)
+ got := VersionForTag(test.in)
+ if got != test.want {
+ t.Errorf("VersionForTag(%q) = %q, want %q", test.in, got, test.want)
}
}
}
diff --git a/internal/stdlib/testdata/v1.12.5/src/context/context_test.go b/internal/stdlib/testdata/v1.12.5/src/context/context_test.go
index f73f2837..0b6ca742 100644
--- a/internal/stdlib/testdata/v1.12.5/src/context/context_test.go
+++ b/internal/stdlib/testdata/v1.12.5/src/context/context_test.go
@@ -139,18 +139,18 @@ func XTestParentFinishesChild(t testingT) {
// The parent's children should contain the two cancelable children.
pc := parent.(*cancelCtx)
cc := cancelChild.(*cancelCtx)
- tc := timerChild.(*timerCtx)
+ test := timerChild.(*timerCtx)
pc.mu.Lock()
- if len(pc.children) != 2 || !contains(pc.children, cc) || !contains(pc.children, tc) {
+ if len(pc.children) != 2 || !contains(pc.children, cc) || !contains(pc.children, test) {
t.Errorf("bad linkage: pc.children = %v, want %v and %v",
- pc.children, cc, tc)
+ pc.children, cc, test)
}
pc.mu.Unlock()
if p, ok := parentCancelCtx(cc.Context); !ok || p != pc {
t.Errorf("bad linkage: parentCancelCtx(cancelChild.Context) = %v, %v want %v, true", p, ok, pc)
}
- if p, ok := parentCancelCtx(tc.Context); !ok || p != pc {
+ if p, ok := parentCancelCtx(test.Context); !ok || p != pc {
t.Errorf("bad linkage: parentCancelCtx(timerChild.Context) = %v, %v want %v, true", p, ok, pc)
}