(t *testing.T)
| 329 | } |
| 330 | |
| 331 | func TestCheckedExprToAstMissingInfo(t *testing.T) { |
| 332 | stdEnv, err := NewEnv() |
| 333 | if err != nil { |
| 334 | t.Fatalf("NewEnv() failed: %v", err) |
| 335 | } |
| 336 | in := "10" |
| 337 | ast, iss := stdEnv.Parse(in) |
| 338 | if iss.Err() != nil { |
| 339 | t.Fatalf("stdEnv.Compile(%q) failed: %v", in, iss.Err()) |
| 340 | } |
| 341 | if ast.ResultType() != decls.Dyn { |
| 342 | t.Fatalf("ast.ResultType() got %v, wanted 'dyn'", ast.ResultType()) |
| 343 | } |
| 344 | expr, err := AstToParsedExpr(ast) |
| 345 | if err != nil { |
| 346 | t.Fatalf("AstToParsedExpr(ast) failed: %v", err) |
| 347 | } |
| 348 | checkedExpr := &exprpb.CheckedExpr{ |
| 349 | TypeMap: map[int64]*exprpb.Type{expr.GetExpr().GetId(): decls.Int}, |
| 350 | Expr: expr.GetExpr(), |
| 351 | } |
| 352 | ast2 := CheckedExprToAst(checkedExpr) |
| 353 | if !ast2.IsChecked() { |
| 354 | t.Fatal("CheckedExprToAst() did not produce a 'checked' ast") |
| 355 | } |
| 356 | if ast2.ResultType() != decls.Int { |
| 357 | t.Fatalf("ast2.ResultType() got %v, wanted 'int'", ast.ResultType()) |
| 358 | } |
| 359 | } |
| 360 | |
| 361 | // deepBoolExpr builds a synthetic deeply nested proto Expr by stacking `depth` unary `!` calls |
| 362 | // on top of a boolean literal. A depth well above the 250 default but far below the Go stack |
nothing calls this directly
no test coverage detected