(t *testing.T)
| 8 | ) |
| 9 | |
| 10 | func TestBatch(t *testing.T) { |
| 11 | // most logic is covered by the chans pkg tests |
| 12 | |
| 13 | t.Run("correctness", func(t *testing.T) { |
| 14 | in := FromChan(th.FromRange(0, 10), fmt.Errorf("err0")) |
| 15 | in = replaceWithError(in, 5, fmt.Errorf("err5")) |
| 16 | in = replaceWithError(in, 7, fmt.Errorf("err7")) |
| 17 | |
| 18 | batches, errs := toSliceAndErrors(Batch(in, 3, -1)) |
| 19 | |
| 20 | th.ExpectValue(t, len(batches), 3) |
| 21 | th.ExpectSlice(t, batches[0], []int{0, 1, 2}) |
| 22 | th.ExpectSlice(t, batches[1], []int{3, 4, 6}) |
| 23 | th.ExpectSlice(t, batches[2], []int{8, 9}) |
| 24 | |
| 25 | th.ExpectSlice(t, errs, []string{"err0", "err5", "err7"}) |
| 26 | }) |
| 27 | |
| 28 | } |
| 29 | |
| 30 | func TestUnbatch(t *testing.T) { |
| 31 | // most logic is covered by the common package tests |
nothing calls this directly
no test coverage detected