(t *testing.T)
| 12 | ) |
| 13 | |
| 14 | func TestNewLatch(t *testing.T) { |
| 15 | latch := asyncbuffer.NewLatch() |
| 16 | |
| 17 | require.NotNil(t, latch) |
| 18 | require.NotNil(t, asyncbuffer.LatchDone(latch)) |
| 19 | |
| 20 | // Channel should be open (not closed) initially |
| 21 | select { |
| 22 | case <-asyncbuffer.LatchDone(latch): |
| 23 | t.Fatal("Latch should not be released initially") |
| 24 | default: |
| 25 | // Expected - channel is not ready |
| 26 | } |
| 27 | } |
| 28 | |
| 29 | func TestLatchRelease(t *testing.T) { |
| 30 | latch := asyncbuffer.NewLatch() |