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

Function TestSingletonOverloadLateBindingCollision

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

Source from the content-addressed store, hash-verified

623}
624
625func TestSingletonOverloadLateBindingCollision(t *testing.T) {
626 fn, err := NewFunction("id",
627 Overload("id_any", []*types.Type{types.AnyType}, types.AnyType,
628 LateFunctionBinding(),
629 ),
630 SingletonUnaryBinding(func(arg ref.Val) ref.Val {
631 return arg
632 }),
633 )
634 if err != nil {
635 t.Fatalf("NewFunction() failed: %v", err)
636 }
637 _, err = fn.Bindings()
638 if err == nil || !strings.Contains(err.Error(), "incompatible with late bindings") {
639 t.Errorf("NewFunction() got %v, wanted incompatible with late bindings", err)
640 }
641}
642
643func TestSingletonUnaryBindingRedefinition(t *testing.T) {
644 _, err := NewFunction("id",

Callers

nothing calls this directly

Calls 7

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

Tested by

no test coverage detected