From ff4efb1a4d232c4ac063ff38f5985661ea97b37e Mon Sep 17 00:00:00 2001 From: Julie Qiu Date: Thu, 19 Nov 2020 23:09:05 -0500 Subject: 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 TryBot-Result: kokoro Reviewed-by: Jonathan Amsterdam Trust: Julie Qiu --- internal/stdlib/stdlib_test.go | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'internal/stdlib/stdlib_test.go') 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) } } } -- cgit v1.3-5-g9baa