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

Function TestFrameUnwrap

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected