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

Function TestSingletonFunctionBindingRedefinition

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

Source from the content-addressed store, hash-verified

670}
671
672func TestSingletonFunctionBindingRedefinition(t *testing.T) {
673 _, err := NewFunction("id",
674 Overload("id_any", []*types.Type{types.AnyType}, types.AnyType),
675 SingletonFunctionBinding(func(args ...ref.Val) ref.Val {
676 return args[0]
677 }, traits.ComparerType),
678 SingletonFunctionBinding(func(args ...ref.Val) ref.Val {
679 return args[0]
680 }, traits.ComparerType),
681 )
682 if err == nil || !strings.Contains(err.Error(), "already has a singleton binding") {
683 t.Errorf("NewCustomEnv() got %v, wanted already has a singleton binding", err)
684 }
685}
686
687func TestOverloadUnaryBindingRedefinition(t *testing.T) {
688 _, err := NewFunction("id",

Callers

nothing calls this directly

Calls 5

NewFunctionFunction · 0.70
OverloadFunction · 0.70
SingletonFunctionBindingFunction · 0.70
ContainsMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected