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)
| 930 | // defensive nil-safety lets future constructors add the field without |
| 931 | // breaking Close(). |
| 932 | func 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 |