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

Function TestAttributesMissingMsg

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

Source from the content-addressed store, hash-verified

876}
877
878func TestAttributesMissingMsg(t *testing.T) {
879 reg := newTestRegistry(t)
880 attrs := NewAttributeFactory(containers.DefaultContainer, reg, reg)
881 anyPB, _ := anypb.New(&proto3pb.TestAllTypes{})
882 vars, _ := NewActivation(map[string]any{
883 "missing_msg": anyPB,
884 })
885
886 // missing_msg.field
887 attr := attrs.AbsoluteAttribute(1, "missing_msg")
888 field := makeQualifier(t, attrs, nil, 2, "field")
889 attr.AddQualifier(field)
890 out, err := attr.Resolve(vars)
891 if err == nil {
892 t.Fatalf("got %v, wanted error", out)
893 }
894 if err.Error() != "unknown type: 'google.expr.proto3.test.TestAllTypes'" {
895 t.Fatalf("got %v, wanted unknown type: 'google.expr.proto3.test.TestAllTypes'", err)
896 }
897}
898
899func TestAttributeMissingMsgUnknownField(t *testing.T) {
900 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