Remove unnecessary copies of loop variables (#28138)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
b6bd92f90e
Коммит
d9e47522a0
@@ -2493,7 +2493,6 @@ func TestIsCRTEnabledForUser(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
th := SetupWithStoreMock(t)
|
||||
defer th.TearDown()
|
||||
|
||||
@@ -57,8 +57,6 @@ func TestMetricsRouter(t *testing.T) {
|
||||
"pprof trace": {path: "/debug/pprof/trace"},
|
||||
} {
|
||||
t.Run(name, func(t *testing.T) {
|
||||
name := name // TODO: Remove once go1.22 is used
|
||||
tc := tc // TODO: Remove once go1.22 is used
|
||||
t.Parallel()
|
||||
|
||||
method := http.MethodGet
|
||||
|
||||
@@ -1472,7 +1472,6 @@ func TestGetEmojiNamesForString(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
testCase := testCase
|
||||
t.Run(testCase.Description, func(t *testing.T) {
|
||||
emojis := getEmojiNamesForString(testCase.Input)
|
||||
assert.ElementsMatch(t, emojis, testCase.Expected, "received incorrect emoji names")
|
||||
@@ -1568,7 +1567,6 @@ func TestGetEmojiNamesForPost(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
testCase := testCase
|
||||
t.Run(testCase.Description, func(t *testing.T) {
|
||||
emojis := getEmojiNamesForPost(testCase.Post, testCase.Reactions)
|
||||
assert.ElementsMatch(t, emojis, testCase.Expected, "received incorrect emoji names")
|
||||
@@ -2829,7 +2827,6 @@ func TestContainsPermalink(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
testCase := testCase
|
||||
t.Run(testCase.Description, func(t *testing.T) {
|
||||
actual := th.App.containsPermalink(th.Context, testCase.Post)
|
||||
assert.Equal(t, testCase.Expected, actual)
|
||||
|
||||
@@ -757,7 +757,6 @@ func TestMaxPostSize(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
testCase := testCase
|
||||
t.Run(testCase.Description, func(t *testing.T) {
|
||||
mockStore := &storetest.Store{}
|
||||
defer mockStore.AssertExpectations(t)
|
||||
|
||||
@@ -277,7 +277,6 @@ func TestGetReplica(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
testCase := testCase
|
||||
t.Run(testCase.Description+" with license", func(t *testing.T) {
|
||||
settings, err := makeSqlSettings(model.DatabaseDriverPostgres)
|
||||
if err != nil {
|
||||
@@ -647,7 +646,6 @@ func TestGetAllConns(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
testCase := testCase
|
||||
t.Run(testCase.Description, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
settings, err := makeSqlSettings(model.DatabaseDriverPostgres)
|
||||
|
||||
@@ -272,7 +272,6 @@ func TestRoundOffToZeroes(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
res := RoundOffToZeroes(tc.n)
|
||||
assert.Equal(t, tc.expected, res)
|
||||
@@ -427,7 +426,6 @@ func TestRoundOffToZeroesResolution(t *testing.T) {
|
||||
},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
tc := tc
|
||||
t.Run(tc.desc, func(t *testing.T) {
|
||||
res := RoundOffToZeroesResolution(tc.n, tc.minResolution)
|
||||
assert.Equal(t, tc.expected, res)
|
||||
|
||||
@@ -480,7 +480,6 @@ func TestParamsFromRequest(t *testing.T) {
|
||||
}
|
||||
|
||||
for _, testCase := range testCases {
|
||||
testCase := testCase
|
||||
t.Run(testCase.Description, func(t *testing.T) {
|
||||
t.Parallel()
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user