MCPcopy
hub / github.com/go-gorm/gorm / TestCallbacksGet

Function TestCallbacksGet

tests/callbacks_test.go:210–223  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

208}
209
210func TestCallbacksGet(t *testing.T) {
211 db, _ := gorm.Open(nil, nil)
212 createCallback := db.Callback().Create()
213
214 createCallback.Before("*").Register("c1", c1)
215 if cb := createCallback.Get("c1"); reflect.DeepEqual(cb, c1) {
216 t.Errorf("callbacks tests failed, got: %p, want: %p", cb, c1)
217 }
218
219 createCallback.Remove("c1")
220 if cb := createCallback.Get("c2"); cb != nil {
221 t.Errorf("callbacks test failed. got: %p, want: nil", cb)
222 }
223}
224
225func TestCallbacksRemove(t *testing.T) {
226 db, _ := gorm.Open(nil, nil)

Callers

nothing calls this directly

Calls 7

OpenFunction · 0.92
CallbackMethod · 0.80
CreateMethod · 0.65
GetMethod · 0.65
RegisterMethod · 0.45
BeforeMethod · 0.45
RemoveMethod · 0.45

Tested by

no test coverage detected