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

Function TestAttributesAbsoluteAttrError

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

Source from the content-addressed store, hash-verified

108}
109
110func TestAttributesAbsoluteAttrError(t *testing.T) {
111 reg := newTestRegistry(t)
112 attrs := NewAttributeFactory(containers.DefaultContainer, reg, reg)
113 vars, err := NewActivation(map[string]any{
114 "err": types.NewErr("invalid variable computation"),
115 })
116 if err != nil {
117 t.Fatalf("NewActivation() failed: %v", err)
118 }
119
120 // acme.a.b[4][false]
121 attr := attrs.AbsoluteAttribute(1, "err")
122 qualMsg := makeQualifier(t, attrs, nil, 2, "message")
123 attr.AddQualifier(qualMsg)
124 out, err := attr.Resolve(vars)
125 if err == nil {
126 t.Errorf("attr.Resolve('err') got %v, wanted error", out)
127 }
128}
129
130func TestAttributesRelativeAttr(t *testing.T) {
131 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