MCPcopy Create free account
hub / github.com/krau/SaveAny-Bot / TestCloseBehavior

Function TestCloseBehavior

pkg/queue/queue_test.go:62–78  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

60}
61
62func TestCloseBehavior(t *testing.T) {
63 q := queue.NewTaskQueue[int]()
64 done := make(chan struct{})
65 // consumer
66 go func() {
67 _, err := q.Get()
68 if err == nil {
69 t.Errorf("expected error when getting from closed empty queue, got nil")
70 }
71 close(done)
72 }()
73 // allow goroutine to block
74
75 // close queue
76 q.Close()
77 <-done
78}
79
80func TestConcurrencySafety(t *testing.T) {
81 q := queue.NewTaskQueue[int]()

Callers

nothing calls this directly

Calls 2

GetMethod · 0.45
CloseMethod · 0.45

Tested by

no test coverage detected