tests/testthat/setup-tests.R

#' Setup Tests Infrastructure
#' 

## Temporary Directory ----

create_temp_compendium <- function(pkg = file.path(tempdir(), "pkgtest")) {
  
  old_wd <- getwd()
  
  withr::defer(fs::dir_delete(pkg), envir = parent.frame())
  
  dir.create(pkg)
  
  setwd(pkg)
  invisible(file.create(".here"))
  
  withr::defer(setwd(old_wd), envir = parent.frame())
  
  invisible(pkg)
}

Try the rcompendium package in your browser

Any scripts or data that you put into this service are public.

rcompendium documentation built on Oct. 26, 2023, 5:08 p.m.