(t *testing.T)
| 322 | } |
| 323 | |
| 324 | func TestNativeFindStructFieldNames(t *testing.T) { |
| 325 | env := testNativeEnv(t, ParseStructTags(true)) |
| 326 | provider := env.CELTypeProvider() |
| 327 | tests := []struct { |
| 328 | typeName string |
| 329 | fields []string |
| 330 | }{ |
| 331 | { |
| 332 | typeName: "ext.TestNestedType", |
| 333 | fields: []string{"NestedListVal", "NestedMapVal", "custom_name"}, |
| 334 | }, |
| 335 | { |
| 336 | typeName: "google.expr.proto3.test.TestAllTypes.NestedMessage", |
| 337 | fields: []string{"bb"}, |
| 338 | }, |
| 339 | { |
| 340 | typeName: "invalid.TypeName", |
| 341 | fields: []string{}, |
| 342 | }, |
| 343 | } |
| 344 | |
| 345 | for _, tst := range tests { |
| 346 | tc := tst |
| 347 | t.Run(fmt.Sprintf("%s", tc.typeName), func(t *testing.T) { |
| 348 | fields, _ := provider.FindStructFieldNames(tc.typeName) |
| 349 | sort.Strings(fields) |
| 350 | sort.Strings(tc.fields) |
| 351 | if !reflect.DeepEqual(fields, tc.fields) { |
| 352 | t.Errorf("got %v, wanted %v", fields, tc.fields) |
| 353 | } |
| 354 | }) |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | func TestNativeTypesStaticErrors(t *testing.T) { |
| 359 | var nativeTests = []struct { |
nothing calls this directly
no test coverage detected