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

Function assertCallbacks

tests/callbacks_test.go:13–24  ·  view source on GitHub ↗
(v interface{}, fnames []string)

Source from the content-addressed store, hash-verified

11)
12
13func assertCallbacks(v interface{}, fnames []string) (result bool, msg string) {
14 var (
15 got []string
16 funcs = reflect.ValueOf(v).Elem().FieldByName("fns")
17 )
18
19 for i := 0; i < funcs.Len(); i++ {
20 got = append(got, getFuncName(funcs.Index(i)))
21 }
22
23 return fmt.Sprint(got) == fmt.Sprint(fnames), fmt.Sprintf("expects %v, got %v", fnames, got)
24}
25
26func getFuncName(fc interface{}) string {
27 reflectValue, ok := fc.(reflect.Value)

Callers 3

TestCallbacksFunction · 0.85
TestPluginCallbacksFunction · 0.85
TestCallbacksRemoveFunction · 0.85

Calls 2

getFuncNameFunction · 0.85
LenMethod · 0.80

Tested by

no test coverage detected