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

Function TestSingletonOverloadCollision

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

Source from the content-addressed store, hash-verified

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