diff options
| author | Julie Qiu <julie@golang.org> | 2020-11-19 23:09:05 -0500 |
|---|---|---|
| committer | Julie Qiu <julie@golang.org> | 2020-11-20 17:06:53 +0000 |
| commit | ff4efb1a4d232c4ac063ff38f5985661ea97b37e (patch) | |
| tree | 0dfc86951e16ff791f5f7d5beba7b461b60a44ff /internal/postgres/insert_module_test.go | |
| parent | 6657ef22c5588415c202445532bd23498217f364 (diff) | |
| download | go-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/postgres/insert_module_test.go')
| -rw-r--r-- | internal/postgres/insert_module_test.go | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/internal/postgres/insert_module_test.go b/internal/postgres/insert_module_test.go index 3468bad2..fe616b8a 100644 --- a/internal/postgres/insert_module_test.go +++ b/internal/postgres/insert_module_test.go @@ -256,11 +256,11 @@ func TestInsertModuleErrors(t *testing.T) { }, } - for _, tc := range testCases { - t.Run(tc.name, func(t *testing.T) { + for _, test := range testCases { + t.Run(test.name, func(t *testing.T) { defer ResetTestDB(testDB, t) - if err := testDB.InsertModule(ctx, tc.module); !errors.Is(err, tc.wantWriteErr) { - t.Errorf("error: %v, want write error: %v", err, tc.wantWriteErr) + if err := testDB.InsertModule(ctx, test.module); !errors.Is(err, test.wantWriteErr) { + t.Errorf("error: %v, want write error: %v", err, test.wantWriteErr) } }) } @@ -340,7 +340,7 @@ func TestLatestVersion(t *testing.T) { } } - for _, tc := range []struct { + for _, test := range []struct { name string modulePath string wantVersion string @@ -361,13 +361,13 @@ func TestLatestVersion(t *testing.T) { wantVersion: "v3.0.1-rc9", }, } { - t.Run(tc.name, func(t *testing.T) { - isLatest, err := isLatestVersion(ctx, testDB.db, tc.modulePath, tc.wantVersion) + t.Run(test.name, func(t *testing.T) { + isLatest, err := isLatestVersion(ctx, testDB.db, test.modulePath, test.wantVersion) if err != nil { t.Fatal(err) } if !isLatest { - t.Errorf("%s is not the latest version", tc.wantVersion) + t.Errorf("%s is not the latest version", test.wantVersion) } }) } @@ -399,7 +399,7 @@ func TestLatestVersion_PreferIncompatibleOverPrerelease(t *testing.T) { } } - for _, tc := range []struct { + for _, test := range []struct { modulePath string want string }{ @@ -408,12 +408,12 @@ func TestLatestVersion_PreferIncompatibleOverPrerelease(t *testing.T) { want: "v2.0.0+incompatible", }, } { - isLatest, err := isLatestVersion(ctx, testDB.db, tc.modulePath, tc.want) + isLatest, err := isLatestVersion(ctx, testDB.db, test.modulePath, test.want) if err != nil { t.Fatal(err) } if !isLatest { - t.Errorf("%s is not the latest version", tc.want) + t.Errorf("%s is not the latest version", test.want) } } } |
