MCPcopy
hub / github.com/destel/rill / ExpectDrainedChan

Function ExpectDrainedChan

internal/th/assertions.go:107–117  ·  view source on GitHub ↗
(t *testing.T, ch <-chan A)

Source from the content-addressed store, hash-verified

105}
106
107func 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
119func ExpectNeverClosedChan[A any](t *testing.T, ch <-chan A, waitFor time.Duration) {
120 t.Helper()

Callers 10

TestErrFunction · 0.92
TestFirstFunction · 0.92
TestForEachFunction · 0.92
TestAnyAllFunction · 0.92
TestReduceFunction · 0.92
TestMapReduceFunction · 0.92
TestToSeq2Function · 0.92
TestFromSeqFunction · 0.92
TestFromSliceFunction · 0.92
TestDrainFunction · 0.92

Calls

no outgoing calls

Tested by 10

TestErrFunction · 0.74
TestFirstFunction · 0.74
TestForEachFunction · 0.74
TestAnyAllFunction · 0.74
TestReduceFunction · 0.74
TestMapReduceFunction · 0.74
TestToSeq2Function · 0.74
TestFromSeqFunction · 0.74
TestFromSliceFunction · 0.74
TestDrainFunction · 0.74