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

Function TestFrameUnwrap

interpreter/frame_test.go:249–271  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

247}
248
249func TestFrameUnwrap(t *testing.T) {
250 baseAct, err := NewActivation(map[string]any{"x": 1})
251 if err != nil {
252 t.Fatalf("NewActivation(x) failed: %v", err)
253 }
254 frame := mustNewExecutionFrame(t, baseAct)
255 defer frame.Close()
256
257 if got := frame.Unwrap(); got != baseAct {
258 t.Errorf("Unwrap() got %v, want %v", got, baseAct)
259 }
260
261 childAct, err := NewActivation(map[string]any{"y": 2})
262 if err != nil {
263 t.Fatalf("NewActivation(y) failed: %v", err)
264 }
265 childFrame := frame.Push(childAct)
266 defer childFrame.Pop()
267
268 if got := childFrame.Unwrap(); got != childFrame.Activation {
269 t.Errorf("Unwrap() got %v, want %v", got, childFrame.Activation)
270 }
271}
272
273func TestFrameAsPartialActivation(t *testing.T) {
274 baseAct, err := NewActivation(map[string]any{"x": 1})

Callers

nothing calls this directly

Calls 6

mustNewExecutionFrameFunction · 0.85
CloseMethod · 0.80
NewActivationFunction · 0.70
UnwrapMethod · 0.65
PushMethod · 0.45
PopMethod · 0.45

Tested by

no test coverage detected