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

Function TestFramePushPop

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

Source from the content-addressed store, hash-verified

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