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

Function TestAddDuplicateDeclarations

checker/checker_test.go:2767–2784  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

2765}
2766
2767func TestAddDuplicateDeclarations(t *testing.T) {
2768 reg, err := types.NewRegistry(types.ProtoTypeDefs(&proto2pb.TestAllTypes{}, &proto3pb.TestAllTypes{}))
2769 if err != nil {
2770 t.Fatalf("types.NewRegistry() failed: %v", err)
2771 }
2772 env, err := NewEnv(containers.DefaultContainer, reg, CrossTypeNumericComparisons(true))
2773 if err != nil {
2774 t.Fatalf("NewEnv() failed: %v", err)
2775 }
2776 err = env.AddFunctions(stdlib.Functions()...)
2777 if err != nil {
2778 t.Fatalf("env.Add() failed: %v", err)
2779 }
2780 err = env.AddFunctions(stdlib.Functions()...)
2781 if err != nil {
2782 t.Errorf("env.Add() failed with duplicate declarations: %v", err)
2783 }
2784}
2785
2786func TestAddEquivalentDeclarations(t *testing.T) {
2787 reg, err := types.NewRegistry(types.ProtoTypeDefs(&proto2pb.TestAllTypes{}, &proto3pb.TestAllTypes{}))

Callers

nothing calls this directly

Calls 6

AddFunctionsMethod · 0.95
NewRegistryFunction · 0.92
ProtoTypeDefsFunction · 0.92
FunctionsFunction · 0.92
NewEnvFunction · 0.70

Tested by

no test coverage detected