(t *testing.T)
| 638 | } |
| 639 | |
| 640 | func TestConcurrentEvalPreCanceledContext(t *testing.T) { |
| 641 | prg := mustProgram(t, `async_func(42)`, |
| 642 | cel.Function("async_func", |
| 643 | cel.Overload("async_func_int", []*cel.Type{cel.IntType}, cel.IntType, |
| 644 | cel.AsyncBinding(func(ctx context.Context, args ...ref.Val) ref.Val { |
| 645 | return args[0] |
| 646 | }), |
| 647 | ), |
| 648 | ), |
| 649 | ) |
| 650 | ctx, cancel := context.WithCancel(context.Background()) |
| 651 | cancel() |
| 652 | res := <-prg.ConcurrentEval(ctx, cel.NoVars()) |
| 653 | if res.Err == nil || !errors.Is(res.Err, context.Canceled) { |
| 654 | t.Errorf("ConcurrentEval() on pre-canceled context = %v, want context.Canceled", res.Err) |
| 655 | } |
| 656 | } |
| 657 | |
| 658 | func TestSyncEvalRejectsAsyncBeforeEvaluating(t *testing.T) { |
| 659 | // The async guard must fire at the entry point, before any evaluation: the async function |
nothing calls this directly
no test coverage detected