MCPcopy Index your code
hub / github.com/aceld/zinx / TestCallbackInvokePanicPropagation

Function TestCallbackInvokePanicPropagation

znet/callbacks_test.go:103–120  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

101}
102
103func TestCallbackInvokePanicPropagation(t *testing.T) {
104 cb := &callbacks{}
105 cb.Add("h", "k1", func() { panic("boom") })
106
107 // Test that panic is propagated (not swallowed by Invoke)
108 defer func() {
109 if r := recover(); r != nil {
110 if r != "boom" {
111 t.Errorf("Expected panic 'boom', got %v", r)
112 }
113 } else {
114 t.Errorf("Expected panic to be propagated, but it was swallowed")
115 }
116 }()
117
118 // This should panic and be caught by the defer above
119 cb.Invoke()
120}

Callers

nothing calls this directly

Calls 3

AddMethod · 0.95
InvokeMethod · 0.95
ErrorfMethod · 0.80

Tested by

no test coverage detected