MCPcopy
hub / github.com/nats-io/nats.go / WaitOnChannel

Function WaitOnChannel

test/helper_test.go:57–67  ·  view source on GitHub ↗
(t *testing.T, ch <-chan T, expected T)

Source from the content-addressed store, hash-verified

55}
56
57func WaitOnChannel[T comparable](t *testing.T, ch <-chan T, expected T) {
58 t.Helper()
59 select {
60 case s := <-ch:
61 if s != expected {
62 t.Fatalf("Expected result: %v; got: %v", expected, s)
63 }
64 case <-time.After(5 * time.Second):
65 t.Fatalf("Timeout waiting for result %v", expected)
66 }
67}
68
69func stackFatalf(t tLogger, f string, args ...any) {
70 lines := make([]string, 0, 32)

Calls 1

FatalfMethod · 0.80

Tested by

no test coverage detected