# Attach packages
library(xpectr)
fn <- function(raise = FALSE){
message("Hi! I'm Kevin, your favorite message!")
warning("G'Day Mam! I'm a warning to the world!")
message("Kevin is ma name! Yesss!")
warning("Hopefully the whole world will see me :o")
if (isTRUE(raise)){
stop("Lord Evil Error has arrived! Yeehaaa")
}
"the output"
}
# \donttest{
capture_side_effects(fn())
capture_side_effects(fn(raise = TRUE))
capture_side_effects(fn(raise = TRUE), copy_env = TRUE)
# }
Run the code above in your browser using DataLab