(t *testing.T)
| 405 | } |
| 406 | |
| 407 | func TestBlockEval_BadBlock(t *testing.T) { |
| 408 | fac := ast.NewExprFactory() |
| 409 | blockExpr := fac.NewCall( |
| 410 | 1, "cel.@block", |
| 411 | fac.NewCall(2, operators.Add, |
| 412 | fac.NewIdent(3, "@index1"), |
| 413 | fac.NewIdent(4, "@index0")), |
| 414 | fac.NewIdent(5, "x"), |
| 415 | ) |
| 416 | blockAST := ast.NewAST(blockExpr, nil) |
| 417 | env, err := cel.NewEnv( |
| 418 | Bindings(BindingsVersion(1)), |
| 419 | cel.Variable("x", cel.StringType), |
| 420 | ) |
| 421 | if err != nil { |
| 422 | t.Fatalf("cel.NewEnv(Bindings()) failed: %v", err) |
| 423 | } |
| 424 | _, err = env.PlanProgram(blockAST) |
| 425 | if err == nil { |
| 426 | t.Fatal("PlanProgram() succeeded, expected error") |
| 427 | } |
| 428 | } |
| 429 | |
| 430 | func TestBlockEval_RuntimeErrors(t *testing.T) { |
| 431 | fac := ast.NewExprFactory() |
nothing calls this directly
no test coverage detected