MCPcopy Create free account
hub / github.com/cel-expr/cel-go / TestAttributesMissingMsg

Function TestAttributesMissingMsg

interpreter/attributes_test.go:1070–1089  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

1068}
1069
1070func TestAttributesMissingMsg(t *testing.T) {
1071 reg := newTestRegistry(t)
1072 attrs := NewAttributeFactory(containers.DefaultContainer, reg, reg)
1073 anyPB, _ := anypb.New(&proto3pb.TestAllTypes{})
1074 vars, _ := NewActivation(map[string]any{
1075 "missing_msg": anyPB,
1076 })
1077
1078 // missing_msg.field
1079 attr := attrs.AbsoluteAttribute(1, "missing_msg")
1080 field := makeQualifier(t, attrs, nil, 2, "field")
1081 attr.AddQualifier(field)
1082 out, err := attr.Resolve(vars)
1083 if err == nil {
1084 t.Fatalf("got %v, wanted error", out)
1085 }
1086 if err.Error() != "unknown type: 'google.expr.proto3.test.TestAllTypes'" {
1087 t.Fatalf("got %v, wanted unknown type: 'google.expr.proto3.test.TestAllTypes'", err)
1088 }
1089}
1090
1091func TestAttributeMissingMsgUnknownField(t *testing.T) {
1092 reg := newTestRegistry(t)

Callers

nothing calls this directly

Calls 9

AbsoluteAttributeMethod · 0.95
NewAttributeFactoryFunction · 0.85
makeQualifierFunction · 0.85
NewMethod · 0.80
newTestRegistryFunction · 0.70
NewActivationFunction · 0.70
AddQualifierMethod · 0.65
ResolveMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected