R version 4.5.0 beta (2025-03-29 r88074 ucrt) -- "How About a Twenty-Six" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > evaluate_expr <- future.tests:::evaluate_expr > > message("*** evaluate_expr() ...") *** evaluate_expr() ... > > for (output in eval(formals(evaluate_expr)$output)) { + res <- evaluate_expr(quote({ print(42) }), output = output) + str(res) + stopifnot(is.null(res$error), !is.null(res$value), res$value == 42) + + res <- evaluate_expr(quote({ stop(42) }), output = output) + str(res) + stopifnot(inherits(res$error, "error"), is.null(res$value)) + } List of 8 $ expr : language { print(42) } $ local : logi TRUE $ timeout: num Inf $ error : NULL $ value : num 42 $ visible: logi FALSE $ output : chr "[1] 42\n" $ time : POSIXct[1:2], format: "2025-03-31 07:22:36" "2025-03-31 07:22:36" List of 8 $ expr : language { stop(42) } $ local : logi TRUE $ timeout: num Inf $ error :List of 3 ..$ message : chr "42" ..$ call : language eval(expr, envir = envir) ..$ traceback:Dotted pair list of 8 .. ..$ : language evaluate_expr(quote({ stop(42) ... .. ..$ : language tryCatch({ if (suppress_messages) { ... .. ..$ : language tryCatchList(expr, classes, parentenv, handlers) .. ..$ : language tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), names[nh], parentenv, handlers[[nh]]) .. ..$ : language doTryCatch(return(expr), name, parentenv, handler) .. ..$ : language tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) .. ..$ : language tryCatchOne(expr, names, parentenv, handlers[[1L]]) .. ..$ : language value[[3L]](cond) ..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition" $ value : NULL $ visible: logi NA $ output : chr "" $ time : POSIXct[1:2], format: "2025-03-31 07:22:37" "2025-03-31 07:22:37" List of 8 $ expr : language { print(42) } $ local : logi TRUE $ timeout: num Inf $ error : NULL $ value : num 42 $ visible: logi FALSE $ output : chr "[1] 42\n" $ time : POSIXct[1:2], format: "2025-03-31 07:22:37" "2025-03-31 07:22:37" List of 8 $ expr : language { stop(42) } $ local : logi TRUE $ timeout: num Inf $ error :List of 3 ..$ message : chr "42" ..$ call : language eval(expr, envir = envir) ..$ traceback:Dotted pair list of 8 .. ..$ : language evaluate_expr(quote({ stop(42) ... .. ..$ : language tryCatch({ if (suppress_messages) { ... .. ..$ : language tryCatchList(expr, classes, parentenv, handlers) .. ..$ : language tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), names[nh], parentenv, handlers[[nh]]) .. ..$ : language doTryCatch(return(expr), name, parentenv, handler) .. ..$ : language tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) .. ..$ : language tryCatchOne(expr, names, parentenv, handlers[[1L]]) .. ..$ : language value[[3L]](cond) ..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition" $ value : NULL $ visible: logi NA $ output : chr "" $ time : POSIXct[1:2], format: "2025-03-31 07:22:37" "2025-03-31 07:22:37" [1] 42 List of 8 $ expr : language { print(42) } $ local : logi TRUE $ timeout: num Inf $ error : NULL $ value : num 42 $ visible: logi FALSE $ output : NULL $ time : POSIXct[1:2], format: "2025-03-31 07:22:37" "2025-03-31 07:22:37" List of 8 $ expr : language { stop(42) } $ local : logi TRUE $ timeout: num Inf $ error :List of 3 ..$ message : chr "42" ..$ call : language eval(expr, envir = envir) ..$ traceback:Dotted pair list of 8 .. ..$ : language evaluate_expr(quote({ stop(42) ... .. ..$ : language tryCatch({ if (suppress_messages) { ... .. ..$ : language tryCatchList(expr, classes, parentenv, handlers) .. ..$ : language tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), names[nh], parentenv, handlers[[nh]]) .. ..$ : language doTryCatch(return(expr), name, parentenv, handler) .. ..$ : language tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) .. ..$ : language tryCatchOne(expr, names, parentenv, handlers[[1L]]) .. ..$ : language value[[3L]](cond) ..- attr(*, "class")= chr [1:3] "simpleError" "error" "condition" $ value : NULL $ visible: logi NA $ output : NULL $ time : POSIXct[1:2], format: "2025-03-31 07:22:37" "2025-03-31 07:22:37" > > message("*** evaluate_expr() ... DONE") *** evaluate_expr() ... DONE > > proc.time() user system elapsed 2.01 0.25 2.18