MCPcopy
hub / github.com/marmotedu/iam / TestErrorHandlerFromFinishShutdown

Function TestErrorHandlerFromFinishShutdown

pkg/shutdown/shutdown_test.go:175–192  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

173}
174
175func TestErrorHandlerFromFinishShutdown(t *testing.T) {
176 c := make(chan int, 100)
177 gs := New()
178
179 gs.SetErrorHandler(ErrorFunc(func(err error) {
180 if err.Error() == "my-error" {
181 c <- 1
182 }
183 }))
184
185 gs.StartShutdown(SMFinishFunc(func() error {
186 return errors.New("my-error")
187 }))
188
189 if len(c) != 1 {
190 t.Error("Expected 1 error from ShutdownFinish, got ", len(c))
191 }
192}
193
194func TestErrorHandlerFromCallbacks(t *testing.T) {
195 c := make(chan int, 100)

Callers

nothing calls this directly

Calls 7

ErrorFuncFuncType · 0.85
SMFinishFuncFuncType · 0.85
SetErrorHandlerMethod · 0.80
NewFunction · 0.70
ErrorMethod · 0.65
StartShutdownMethod · 0.65
NewMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…