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

Function TestExpressionNestingDepthLimitConfigRoundTrip

cel/io_test.go:442–463  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

440}
441
442func TestExpressionNestingDepthLimitConfigRoundTrip(t *testing.T) {
443 env, err := NewEnv(ExpressionNestingDepthLimit(128))
444 if err != nil {
445 t.Fatalf("NewEnv(ExpressionNestingDepthLimit(128)) failed: %v", err)
446 }
447 conf, err := env.ToConfig("depth-limit")
448 if err != nil {
449 t.Fatalf("env.ToConfig() failed: %v", err)
450 }
451 found := false
452 for _, limit := range conf.Limits {
453 if limit.Name == "cel.limit.max_ast_depth" {
454 found = true
455 if limit.Value != 128 {
456 t.Errorf("limit %q value = %d, wanted 128", limit.Name, limit.Value)
457 }
458 }
459 }
460 if !found {
461 t.Errorf("env config limits %v missing 'cel.limit.max_ast_depth'", conf.Limits)
462 }
463}
464
465func TestRefValueToValue_Error(t *testing.T) {
466 _, err := RefValueToValue(types.NewErr("test error"))

Callers

nothing calls this directly

Calls 3

ToConfigMethod · 0.95
NewEnvFunction · 0.70

Tested by

no test coverage detected