(t *testing.T)
| 158 | } |
| 159 | |
| 160 | func TestChannelIterator(t *testing.T) { |
| 161 | t.Parallel() |
| 162 | |
| 163 | assert := internal.NewAssert(t, "TestRangeIterator") |
| 164 | |
| 165 | var iter Iterator[int] = FromSlice([]int{1, 2, 3, 4}) |
| 166 | |
| 167 | ctx, cancel := context.WithCancel(context.Background()) |
| 168 | iter = FromChannel(ToChannel(ctx, iter, 0)) |
| 169 | item, ok := iter.Next() |
| 170 | assert.Equal(1, item) |
| 171 | assert.Equal(true, ok) |
| 172 | assert.Equal(true, iter.HasNext()) |
| 173 | |
| 174 | cancel() |
| 175 | |
| 176 | _, ok = iter.Next() |
| 177 | assert.Equal(false, ok) |
| 178 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…