(t *testing.T)
| 379 | } |
| 380 | |
| 381 | func TestBlockEval_BadPlan(t *testing.T) { |
| 382 | fac := ast.NewExprFactory() |
| 383 | blockExpr := fac.NewCall( |
| 384 | 1, "cel.@block", |
| 385 | fac.NewList(2, []ast.Expr{ |
| 386 | fac.NewIdent(3, "x"), |
| 387 | fac.NewIdent(4, "@index0"), |
| 388 | }, []int32{}), |
| 389 | fac.NewCall(6, operators.Add, |
| 390 | fac.NewIdent(7, "@index1"), |
| 391 | fac.NewIdent(8, "@index0")), |
| 392 | fac.NewIdent(9, "x"), |
| 393 | ) |
| 394 | blockAST := ast.NewAST(blockExpr, nil) |
| 395 | env, err := cel.NewEnv( |
| 396 | Bindings(BindingsVersion(1)), |
| 397 | cel.Variable("x", cel.StringType), |
| 398 | ) |
| 399 | if err != nil { |
| 400 | t.Fatalf("cel.NewEnv(Bindings()) failed: %v", err) |
| 401 | } |
| 402 | _, err = env.PlanProgram(blockAST) |
| 403 | if err == nil { |
| 404 | t.Fatal("PlanProgram() succeeded, expected error") |
| 405 | } |
| 406 | } |
| 407 | |
| 408 | func TestBlockEval_BadBlock(t *testing.T) { |
| 409 | fac := ast.NewExprFactory() |
nothing calls this directly
no test coverage detected