Wait for a chan with a timeout.
(ch chan bool, timeout time.Duration)
| 46 | |
| 47 | // Wait for a chan with a timeout. |
| 48 | func WaitTime(ch chan bool, timeout time.Duration) error { |
| 49 | select { |
| 50 | case <-ch: |
| 51 | return nil |
| 52 | case <-time.After(timeout): |
| 53 | } |
| 54 | return errors.New("timeout") |
| 55 | } |
| 56 | |
| 57 | func WaitOnChannel[T comparable](t *testing.T, ch <-chan T, expected T) { |
| 58 | t.Helper() |
no outgoing calls
no test coverage detected