(t *testing.T)
| 929 | } |
| 930 | |
| 931 | func TestNativeStructWithMultipleSameFieldNames(t *testing.T) { |
| 932 | tagHandler := func(f reflect.StructField) string { |
| 933 | tag, found := f.Tag.Lookup("cel") |
| 934 | if found { |
| 935 | splits := strings.Split(tag, ",") |
| 936 | if len(splits) > 0 { |
| 937 | return splits[0] |
| 938 | } |
| 939 | } |
| 940 | return f.Name |
| 941 | } |
| 942 | _, err := types.NewNativeType( |
| 943 | reflect.TypeFor[TestStructWithMultipleSameNames](), |
| 944 | types.ParseStructField(tagHandler), |
| 945 | ) |
| 946 | if err == nil { |
| 947 | t.Fatal("NewNativeType() did not fail as expected") |
| 948 | } |
| 949 | if !strings.Contains(err.Error(), "field name already exists") { |
| 950 | t.Fatalf("NewNativeType() expected duplicated field name error, but got: %v", err) |
| 951 | } |
| 952 | } |
| 953 | |
| 954 | func TestNativeStructEmbedded(t *testing.T) { |
| 955 | var nativeTests = []struct { |
nothing calls this directly
no test coverage detected