(t *testing.T)
| 755 | } |
| 756 | |
| 757 | func TestConcurrentEvalPreCanceledContext(t *testing.T) { |
| 758 | prg := mustProgram(t, `async_func(42)`, |
| 759 | cel.Function("async_func", |
| 760 | cel.Overload("async_func_int", []*cel.Type{cel.IntType}, cel.IntType, |
| 761 | cel.AsyncBinding(func(ctx context.Context, args ...ref.Val) ref.Val { |
| 762 | return args[0] |
| 763 | }), |
| 764 | ), |
| 765 | ), |
| 766 | ) |
| 767 | ctx, cancel := context.WithCancel(context.Background()) |
| 768 | cancel() |
| 769 | res := <-prg.ConcurrentEval(ctx, cel.NoVars()) |
| 770 | if res.Err == nil || !errors.Is(res.Err, context.Canceled) { |
| 771 | t.Errorf("ConcurrentEval() on pre-canceled context = %v, want context.Canceled", res.Err) |
| 772 | } |
| 773 | } |
| 774 | |
| 775 | func TestSyncEvalRejectsAsyncBeforeEvaluating(t *testing.T) { |
| 776 | // The async guard must fire at the entry point, before any evaluation: the async function |
nothing calls this directly
no test coverage detected