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

Function TestSingletonOverloadCollision

common/decls/decls_test.go:605–623  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

603}
604
605func TestSingletonOverloadCollision(t *testing.T) {
606 fn, err := NewFunction("id",
607 Overload("id_any", []*types.Type{types.AnyType}, types.AnyType,
608 UnaryBinding(func(arg ref.Val) ref.Val {
609 return arg
610 }),
611 ),
612 SingletonUnaryBinding(func(arg ref.Val) ref.Val {
613 return arg
614 }),
615 )
616 if err != nil {
617 t.Fatalf("NewFunction() failed: %v", err)
618 }
619 _, err = fn.Bindings()
620 if err == nil || !strings.Contains(err.Error(), "incompatible with specialized overloads") {
621 t.Errorf("NewFunction() got %v, wanted incompatible with specialized overloads", err)
622 }
623}
624
625func TestSingletonOverloadLateBindingCollision(t *testing.T) {
626 fn, err := NewFunction("id",

Callers

nothing calls this directly

Calls 7

BindingsMethod · 0.80
NewFunctionFunction · 0.70
OverloadFunction · 0.70
UnaryBindingFunction · 0.70
SingletonUnaryBindingFunction · 0.70
ContainsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected