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

Function TestAddDuplicateDeclarations

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

Source from the content-addressed store, hash-verified

2723}
2724
2725func TestAddDuplicateDeclarations(t *testing.T) {
2726 reg, err := types.NewRegistry(types.ProtoTypeDefs(&proto2pb.TestAllTypes{}, &proto3pb.TestAllTypes{}))
2727 if err != nil {
2728 t.Fatalf("types.NewRegistry() failed: %v", err)
2729 }
2730 env, err := NewEnv(containers.DefaultContainer, reg, CrossTypeNumericComparisons(true))
2731 if err != nil {
2732 t.Fatalf("NewEnv() failed: %v", err)
2733 }
2734 err = env.AddFunctions(stdlib.Functions()...)
2735 if err != nil {
2736 t.Fatalf("env.Add() failed: %v", err)
2737 }
2738 err = env.AddFunctions(stdlib.Functions()...)
2739 if err != nil {
2740 t.Errorf("env.Add() failed with duplicate declarations: %v", err)
2741 }
2742}
2743
2744func TestAddEquivalentDeclarations(t *testing.T) {
2745 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