(t *testing.T)
| 288 | } |
| 289 | |
| 290 | func TestCheckedExprToAstMissingInfo(t *testing.T) { |
| 291 | stdEnv, err := NewEnv() |
| 292 | if err != nil { |
| 293 | t.Fatalf("NewEnv() failed: %v", err) |
| 294 | } |
| 295 | in := "10" |
| 296 | ast, iss := stdEnv.Parse(in) |
| 297 | if iss.Err() != nil { |
| 298 | t.Fatalf("stdEnv.Compile(%q) failed: %v", in, iss.Err()) |
| 299 | } |
| 300 | if ast.ResultType() != decls.Dyn { |
| 301 | t.Fatalf("ast.ResultType() got %v, wanted 'dyn'", ast.ResultType()) |
| 302 | } |
| 303 | expr, err := AstToParsedExpr(ast) |
| 304 | if err != nil { |
| 305 | t.Fatalf("AstToParsedExpr(ast) failed: %v", err) |
| 306 | } |
| 307 | checkedExpr := &exprpb.CheckedExpr{ |
| 308 | TypeMap: map[int64]*exprpb.Type{expr.GetExpr().GetId(): decls.Int}, |
| 309 | Expr: expr.GetExpr(), |
| 310 | } |
| 311 | ast2 := CheckedExprToAst(checkedExpr) |
| 312 | if !ast2.IsChecked() { |
| 313 | t.Fatal("CheckedExprToAst() did not produce a 'checked' ast") |
| 314 | } |
| 315 | if ast2.ResultType() != decls.Int { |
| 316 | t.Fatalf("ast2.ResultType() got %v, wanted 'int'", ast.ResultType()) |
| 317 | } |
| 318 | } |
| 319 | |
| 320 | func TestRefValueToValue_Error(t *testing.T) { |
| 321 | _, err := RefValueToValue(types.NewErr("test error")) |
nothing calls this directly
no test coverage detected