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

Function TestComputeResultWithoutContext

interpreter/async_test.go:85–102  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

83}
84
85func TestComputeResultWithoutContext(t *testing.T) {
86 frame, err := NewExecutionFrame(EmptyActivation())
87 if err != nil {
88 t.Fatalf("NewExecutionFrame() failed: %v", err)
89 }
90 defer frame.Close()
91 // No SetContext call, so async tracking is uninitialized.
92 res := frame.ComputeResult(1, "fn", "fn_overload", asyncReturning(types.Int(1), nil), nil)
93 if !types.IsError(res) {
94 t.Errorf("ComputeResult() got %v, wanted error when tracking uninitialized", res)
95 }
96 if frame.ActiveAsyncCalls() != 0 {
97 t.Errorf("ActiveAsyncCalls() = %d, wanted 0", frame.ActiveAsyncCalls())
98 }
99 if call := frame.AsyncCall(1); call != nil {
100 t.Errorf("AsyncCall() = %v, wanted nil", call)
101 }
102}
103
104func TestComputeResultResolves(t *testing.T) {
105 ctx, cancel := context.WithCancel(context.Background())

Callers

nothing calls this directly

Calls 9

CloseMethod · 0.95
ComputeResultMethod · 0.95
ActiveAsyncCallsMethod · 0.95
AsyncCallMethod · 0.95
IntTypeAlias · 0.92
IsErrorFunction · 0.92
NewExecutionFrameFunction · 0.85
EmptyActivationFunction · 0.85
asyncReturningFunction · 0.85

Tested by

no test coverage detected