(t *testing.T)
| 49 | } |
| 50 | |
| 51 | func TestBatchErrorConcurrentAdd(t *testing.T) { |
| 52 | const count = 10000 |
| 53 | var batch BatchError |
| 54 | var wg sync.WaitGroup |
| 55 | |
| 56 | wg.Add(count) |
| 57 | for i := 0; i < count; i++ { |
| 58 | go func() { |
| 59 | defer wg.Done() |
| 60 | batch.Add(errors.New(err1)) |
| 61 | }() |
| 62 | } |
| 63 | wg.Wait() |
| 64 | |
| 65 | assert.NotNil(t, batch.Err()) |
| 66 | assert.Equal(t, count, len(batch.errs)) |
| 67 | assert.True(t, batch.NotNil()) |
| 68 | } |
| 69 | |
| 70 | func TestBatchError_Unwrap(t *testing.T) { |
| 71 | t.Run("nil", func(t *testing.T) { |