(t *testing.T, ch <-chan A)
| 105 | } |
| 106 | |
| 107 | func ExpectDrainedChan[A any](t *testing.T, ch <-chan A) { |
| 108 | t.Helper() |
| 109 | select { |
| 110 | case x, ok := <-ch: |
| 111 | if ok { |
| 112 | t.Errorf("expected channel to be closed, but got %v", x) |
| 113 | } |
| 114 | default: |
| 115 | t.Errorf("expected channel to be closed, but it's blocked") |
| 116 | } |
| 117 | } |
| 118 | |
| 119 | func ExpectNeverClosedChan[A any](t *testing.T, ch <-chan A, waitFor time.Duration) { |
| 120 | t.Helper() |
no outgoing calls