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

Function TestExpressionNestingDepthLimitConfigRoundTrip

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

Source from the content-addressed store, hash-verified

399}
400
401func TestExpressionNestingDepthLimitConfigRoundTrip(t *testing.T) {
402 env, err := NewEnv(ExpressionNestingDepthLimit(128))
403 if err != nil {
404 t.Fatalf("NewEnv(ExpressionNestingDepthLimit(128)) failed: %v", err)
405 }
406 conf, err := env.ToConfig("depth-limit")
407 if err != nil {
408 t.Fatalf("env.ToConfig() failed: %v", err)
409 }
410 found := false
411 for _, limit := range conf.Limits {
412 if limit.Name == "cel.limit.max_ast_depth" {
413 found = true
414 if limit.Value != 128 {
415 t.Errorf("limit %q value = %d, wanted 128", limit.Name, limit.Value)
416 }
417 }
418 }
419 if !found {
420 t.Errorf("env config limits %v missing 'cel.limit.max_ast_depth'", conf.Limits)
421 }
422}
423
424func TestRefValueToValue_Error(t *testing.T) {
425 _, 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