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

Function TestJSONFieldNamesInvalidProvider

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

Source from the content-addressed store, hash-verified

5141}
5142
5143func TestJSONFieldNamesInvalidProvider(t *testing.T) {
5144 type wrapperRegistry struct {
5145 *types.Registry
5146 }
5147 reg, err := types.NewRegistry(types.JSONFieldNames(true))
5148 if err != nil {
5149 t.Fatalf("types.NewRegistry() failed: %v", err)
5150 }
5151 wrapped := wrapperRegistry{Registry: reg}
5152 _, err = NewEnv(CustomTypeProvider(wrapped), CustomTypeAdapter(reg), JSONFieldNames(true))
5153 if err == nil {
5154 t.Error("NewEnv() created a CEL environment successfully despite incompatible configs")
5155 }
5156}
5157
5158// TODO: ideally testCostEstimator and testRuntimeCostEstimator would be shared in a test fixtures package
5159type testCostEstimator struct {

Callers

nothing calls this directly

Calls 7

NewRegistryFunction · 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