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

Function buildZeroArgAsync

cel/async/async_test.go:43–60  ·  view source on GitHub ↗

buildZeroArgAsync builds a zero-arity async overload from an option and returns its AsyncOp.

(t *testing.T, opt decls.OverloadOpt)

Source from the content-addressed store, hash-verified

41
42// buildZeroArgAsync builds a zero-arity async overload from an option and returns its AsyncOp.
43func buildZeroArgAsync(t *testing.T, opt decls.OverloadOpt) functions.AsyncOp {
44 t.Helper()
45 fnDecl, err := decls.NewFunction("fn", decls.Overload("fn_zero", []*types.Type{}, types.IntType, opt))
46 if err != nil {
47 t.Fatalf("NewFunction() failed: %v", err)
48 }
49 bindings, err := fnDecl.Bindings()
50 if err != nil {
51 t.Fatalf("Bindings() failed: %v", err)
52 }
53 for _, b := range bindings {
54 if b.Async != nil {
55 return b.Async
56 }
57 }
58 t.Fatal("no async binding produced")
59 return nil
60}
61
62func TestRetryMultipleAttemptsTimerReset(t *testing.T) {
63 var attempts atomic.Int32

Calls 3

NewFunctionFunction · 0.92
OverloadFunction · 0.92
BindingsMethod · 0.80

Tested by

no test coverage detected