mustFinish fails the test if fn does not return within d.
(t *testing.T, d time.Duration, msg string, fn func())
| 50 | |
| 51 | // mustFinish fails the test if fn does not return within d. |
| 52 | func mustFinish(t *testing.T, d time.Duration, msg string, fn func()) { |
| 53 | t.Helper() |
| 54 | done := make(chan struct{}) |
| 55 | go func() { fn(); close(done) }() |
| 56 | select { |
| 57 | case <-done: |
| 58 | case <-time.After(d): |
| 59 | t.Fatalf("timeout: %s", msg) |
| 60 | } |
| 61 | } |
| 62 | |
| 63 | // --------------------------------------------------------------------------- |
| 64 | // addAddition |
no outgoing calls
no test coverage detected