MCPcopy
hub / github.com/redis/go-redis / TestOnCloseHooks_NilReceiver

Function TestOnCloseHooks_NilReceiver

internal_test.go:932–937  ·  view source on GitHub ↗

TestOnCloseHooks_NilReceiver ensures run() on a nil registry is a safe no-op. baseClient embedded in Conn/Tx does initialize the registry, but defensive nil-safety lets future constructors add the field without breaking Close().

(t *testing.T)

Source from the content-addressed store, hash-verified

930// defensive nil-safety lets future constructors add the field without
931// breaking Close().
932func TestOnCloseHooks_NilReceiver(t *testing.T) {
933 var h *onCloseHooks
934 if err := h.run(); err != nil {
935 t.Fatalf("run() on nil = %v, want nil", err)
936 }
937}
938
939// TestOnCloseHooks_ConcurrentRegisterSameID hammers the registry with many
940// goroutines re-registering under the same id. The registry must remain

Callers

nothing calls this directly

Calls 1

runMethod · 0.95

Tested by

no test coverage detected