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

Function TestFramePushPop

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

Source from the content-addressed store, hash-verified

332}
333
334func TestFramePushPop(t *testing.T) {
335 baseAct, err := NewActivation(map[string]any{"x": 1})
336 if err != nil {
337 t.Fatalf("NewActivation(x) failed: %v", err)
338 }
339 childAct, err := NewActivation(map[string]any{"y": 2})
340 if err != nil {
341 t.Fatalf("NewActivation(y) failed: %v", err)
342 }
343
344 frame := mustNewExecutionFrame(t, baseAct)
345 defer frame.Close()
346
347 childFrame := frame.Push(childAct)
348 if childFrame == nil {
349 t.Fatal("push() returned nil")
350 }
351 if childFrame.parent != frame {
352 t.Errorf("push() parent got %v, want %v", childFrame.parent, frame)
353 }
354
355 popped := childFrame.Pop()
356 if popped != frame {
357 t.Errorf("pop() got %v, want %v", popped, frame)
358 }
359}
360
361func TestFrameClose(t *testing.T) {
362 frame := mustNewExecutionFrame(t, EmptyActivation())

Callers

nothing calls this directly

Calls 5

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

Tested by

no test coverage detected