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

Function TestAttributesAbsoluteAttrError

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

Source from the content-addressed store, hash-verified

85}
86
87func TestAttributesAbsoluteAttrError(t *testing.T) {
88 reg := newTestRegistry(t)
89 attrs := NewAttributeFactory(containers.DefaultContainer, reg, reg)
90 vars, err := NewActivation(map[string]any{
91 "err": types.NewErr("invalid variable computation"),
92 })
93 if err != nil {
94 t.Fatalf("NewActivation() failed: %v", err)
95 }
96
97 // acme.a.b[4][false]
98 attr := attrs.AbsoluteAttribute(1, "err")
99 qualMsg := makeQualifier(t, attrs, nil, 2, "message")
100 attr.AddQualifier(qualMsg)
101 out, err := attr.Resolve(vars)
102 if err == nil {
103 t.Errorf("attr.Resolve('err') got %v, wanted error", out)
104 }
105}
106
107func TestAttributesRelativeAttr(t *testing.T) {
108 reg := newTestRegistry(t)

Callers

nothing calls this directly

Calls 8

AbsoluteAttributeMethod · 0.95
NewErrFunction · 0.92
NewAttributeFactoryFunction · 0.85
makeQualifierFunction · 0.85
newTestRegistryFunction · 0.70
NewActivationFunction · 0.70
AddQualifierMethod · 0.65
ResolveMethod · 0.65

Tested by

no test coverage detected