MCPcopy Create free account
hub / github.com/chainreactors/spray / mustFinish

Function mustFinish

core/pool/pool_test.go:52–61  ·  view source on GitHub ↗

mustFinish fails the test if fn does not return within d.

(t *testing.T, d time.Duration, msg string, fn func())

Source from the content-addressed store, hash-verified

50
51// mustFinish fails the test if fn does not return within d.
52func 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

Calls

no outgoing calls

Tested by

no test coverage detected