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

Function TestContextEvalRejectsAsync

cel/program_async_test.go:507–517  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

505}
506
507func TestContextEvalRejectsAsync(t *testing.T) {
508 prg := mustProgram(t, `rpc("a")`,
509 cel.Function("rpc",
510 cel.Overload("rpc_string", []*cel.Type{cel.StringType}, cel.StringType,
511 cel.AsyncBinding(func(ctx context.Context, args ...ref.Val) ref.Val { return args[0] }))),
512 )
513 _, _, err := prg.ContextEval(context.Background(), cel.NoVars())
514 if err == nil || !strings.Contains(err.Error(), "ConcurrentEval") {
515 t.Errorf("ContextEval() on async expr = %v, want error mentioning ConcurrentEval", err)
516 }
517}
518
519func TestEvalRejectsAsync(t *testing.T) {
520 prg := mustProgram(t, `rpc("a")`,

Callers

nothing calls this directly

Calls 8

FunctionFunction · 0.92
OverloadFunction · 0.92
AsyncBindingFunction · 0.92
NoVarsFunction · 0.92
mustProgramFunction · 0.85
ContextEvalMethod · 0.65
ContainsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected