(interfaceName string, packagePath string, initStructs []any)
| 230 | } |
| 231 | |
| 232 | func 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 | } |
no test coverage detected