@@ -174,13 +174,13 @@ func TestForIterator_EachIdxErr(t *testing.T) {
174
174
t .Parallel ()
175
175
176
176
t .Run ("failFast=false" , func (t * testing.T ) {
177
- it := Iterator [int ]{MaxGoroutines : 999 }
177
+ it := iter. Iterator [int ]{MaxGoroutines : 999 }
178
178
forEach := noIndex (it .ForEachIdxErr )
179
179
testForEachErr (t , false , forEach )
180
180
})
181
181
182
182
t .Run ("failFast=true" , func (t * testing.T ) {
183
- it := Iterator [int ]{MaxGoroutines : 999 }
183
+ it := iter. Iterator [int ]{MaxGoroutines : 999 }
184
184
forEach := noIndex (it .ForEachIdxErr )
185
185
testForEachErr (t , true , forEach )
186
186
})
@@ -190,7 +190,7 @@ func TestForIterator_EachIdxErr(t *testing.T) {
190
190
191
191
input := []int {1 , 2 , 3 , 4 , 5 }
192
192
errTest := errors .New ("test error" )
193
- iterator := Iterator [int ]{MaxGoroutines : 1 , FailFast : true }
193
+ iterator := iter. Iterator [int ]{MaxGoroutines : 1 , FailFast : true }
194
194
195
195
var mu sync.Mutex
196
196
var results []int
@@ -211,7 +211,7 @@ func TestForIterator_EachIdxErr(t *testing.T) {
211
211
t .Run ("safe for reuse" , func (t * testing.T ) {
212
212
t .Parallel ()
213
213
214
- iterator := Iterator [int ]{MaxGoroutines : 999 }
214
+ iterator := iter. Iterator [int ]{MaxGoroutines : 999 }
215
215
216
216
// iter.Concurrency > numInput case that updates iter.Concurrency
217
217
_ = iterator .ForEachIdxErr ([]int {1 , 2 , 3 }, func (i int , t * int ) error {
@@ -224,12 +224,12 @@ func TestForIterator_EachIdxErr(t *testing.T) {
224
224
t .Run ("allows more than defaultMaxGoroutines() concurrent tasks" , func (t * testing.T ) {
225
225
t .Parallel ()
226
226
227
- wantConcurrency := 2 * defaultMaxGoroutines ()
227
+ wantConcurrency := 2 * iter . DefaultMaxGoroutines ()
228
228
229
229
maxConcurrencyHit := make (chan struct {})
230
230
231
231
tasks := make ([]int , wantConcurrency )
232
- iterator := Iterator [int ]{MaxGoroutines : wantConcurrency }
232
+ iterator := iter. Iterator [int ]{MaxGoroutines : wantConcurrency }
233
233
234
234
var concurrentTasks atomic.Int64
235
235
_ = iterator .ForEachIdxErr (tasks , func (_ int , t * int ) error {
@@ -257,19 +257,19 @@ func TestForIterator_EachErr(t *testing.T) {
257
257
t .Parallel ()
258
258
259
259
t .Run ("failFast=false" , func (t * testing.T ) {
260
- it := Iterator [int ]{MaxGoroutines : 999 }
260
+ it := iter. Iterator [int ]{MaxGoroutines : 999 }
261
261
testForEachErr (t , false , it .ForEachErr )
262
262
})
263
263
264
264
t .Run ("failFast=true" , func (t * testing.T ) {
265
- it := Iterator [int ]{MaxGoroutines : 999 }
265
+ it := iter. Iterator [int ]{MaxGoroutines : 999 }
266
266
testForEachErr (t , true , it .ForEachErr )
267
267
})
268
268
269
269
t .Run ("safe for reuse" , func (t * testing.T ) {
270
270
t .Parallel ()
271
271
272
- iterator := Iterator [int ]{MaxGoroutines : 999 }
272
+ iterator := iter. Iterator [int ]{MaxGoroutines : 999 }
273
273
274
274
// iter.Concurrency > numInput case that updates iter.Concurrency
275
275
_ = iterator .ForEachErr ([]int {1 , 2 , 3 }, func (t * int ) error {
@@ -284,7 +284,7 @@ func TestForIterator_EachErr(t *testing.T) {
284
284
285
285
input := []int {1 , 2 , 3 , 4 , 5 }
286
286
errTest := errors .New ("test error" )
287
- iterator := Iterator [int ]{MaxGoroutines : 1 , FailFast : true }
287
+ iterator := iter. Iterator [int ]{MaxGoroutines : 1 , FailFast : true }
288
288
289
289
var mu sync.Mutex
290
290
var results []int
@@ -305,12 +305,12 @@ func TestForIterator_EachErr(t *testing.T) {
305
305
t .Run ("allows more than defaultMaxGoroutines() concurrent tasks" , func (t * testing.T ) {
306
306
t .Parallel ()
307
307
308
- wantConcurrency := 2 * defaultMaxGoroutines ()
308
+ wantConcurrency := 2 * iter . DefaultMaxGoroutines ()
309
309
310
310
maxConcurrencyHit := make (chan struct {})
311
311
312
312
tasks := make ([]int , wantConcurrency )
313
- iterator := Iterator [int ]{MaxGoroutines : wantConcurrency }
313
+ iterator := iter. Iterator [int ]{MaxGoroutines : wantConcurrency }
314
314
315
315
var concurrentTasks atomic.Int64
316
316
_ = iterator .ForEachErr (tasks , func (t * int ) error {
@@ -338,7 +338,7 @@ func TestForEachIdxErr(t *testing.T) {
338
338
t .Parallel ()
339
339
340
340
t .Run ("standart" , func (t * testing.T ) {
341
- forEach := noIndex (ForEachIdxErr [int ])
341
+ forEach := noIndex (iter . ForEachIdxErr [int ])
342
342
testForEachErr (t , false , forEach )
343
343
})
344
344
@@ -347,7 +347,7 @@ func TestForEachIdxErr(t *testing.T) {
347
347
got := []int {}
348
348
gotMu := sync.Mutex {}
349
349
350
- err := ForEachIdxErr (ints , func (i int , _ * int ) error {
350
+ err := iter . ForEachIdxErr (ints , func (i int , _ * int ) error {
351
351
gotMu .Lock ()
352
352
defer gotMu .Unlock ()
353
353
got = append (got , i )
@@ -362,7 +362,7 @@ func TestForEachIdxErr(t *testing.T) {
362
362
func TestForEachErr (t * testing.T ) {
363
363
t .Parallel ()
364
364
365
- testForEachErr (t , false , ForEachErr [int ])
365
+ testForEachErr (t , false , iter . ForEachErr [int ])
366
366
}
367
367
368
368
// noIndex converts a ForEachIdxErr function (or method) into a ForEachErr function (or method).
0 commit comments