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

Function TestSingletonFunctionBindingRedefinition

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

Source from the content-addressed store, hash-verified

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