(t *testing.T)
| 399 | } |
| 400 | |
| 401 | func 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 | |
| 424 | func TestRefValueToValue_Error(t *testing.T) { |
| 425 | _, err := RefValueToValue(types.NewErr("test error")) |
nothing calls this directly
no test coverage detected