MCPcopy
hub / github.com/uber-go/nilaway / structsCheckedTestHelper

Function structsCheckedTestHelper

annotation/helper_test.go:232–251  ·  view source on GitHub ↗
(interfaceName string, packagePath string, initStructs []any)

Source from the content-addressed store, hash-verified

230}
231
232func structsCheckedTestHelper(interfaceName string, packagePath string, initStructs []any) []string {
233 expected := structsImplementingInterface(interfaceName, packagePath)
234 if len(expected) == 0 {
235 panic(fmt.Sprintf("no structs found implementing `%s` interface", interfaceName))
236 }
237
238 actual := make(map[string]bool)
239 for _, initStruct := range initStructs {
240 actual[reflect.TypeOf(initStruct).Elem().Name()] = true
241 }
242
243 // compare expected and actual, and find structs that were not tested
244 var missedStructs []string
245 for structName := range expected {
246 if !actual[structName] {
247 missedStructs = append(missedStructs, structName)
248 }
249 }
250 return missedStructs
251}

Callers 2

TestStructsCheckedMethod · 0.85
TestStructsCheckedMethod · 0.85

Calls 1

Tested by

no test coverage detected