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

Function TestJSONFieldNamesInvalidProvider

cel/cel_test.go:3923–3936  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3921}
3922
3923func TestJSONFieldNamesInvalidProvider(t *testing.T) {
3924 type wrapperRegistry struct {
3925 *types.Registry
3926 }
3927 reg, err := types.NewProtoRegistry(types.JSONFieldNames(true))
3928 if err != nil {
3929 t.Fatalf("types.NewProtoRegistry() failed: %v", err)
3930 }
3931 wrapped := wrapperRegistry{Registry: reg}
3932 _, err = NewEnv(CustomTypeProvider(wrapped), CustomTypeAdapter(reg), JSONFieldNames(true))
3933 if err == nil {
3934 t.Error("NewEnv() created a CEL environment successfully despite incompatible configs")
3935 }
3936}
3937
3938// TODO: ideally testCostEstimator and testRuntimeCostEstimator would be shared in a test fixtures package
3939type testCostEstimator struct {

Callers

nothing calls this directly

Calls 7

NewProtoRegistryFunction · 0.92
JSONFieldNamesFunction · 0.92
CustomTypeProviderFunction · 0.85
CustomTypeAdapterFunction · 0.85
NewEnvFunction · 0.70
JSONFieldNamesFunction · 0.70
ErrorMethod · 0.45

Tested by

no test coverage detected