tests/fns.R

create_tmp_package <- function(){
  tmp <- tempdir()
  # make sure it's empty
  files <- list.files(tmp)
  sapply(files, empty, dir = tmp)
  suppressMessages(usethis::create_package(tmp))
  return(tmp)
}

empty <- function(file, dir = tmp){
  path <- file.path(dir, file)
  unlink(file, recursive = TRUE, force = TRUE)
}

delete_tmp_package <- function(tmp){
  unlink(tmp, recursive = TRUE, force = TRUE)
}

Try the leprechaun package in your browser

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

leprechaun documentation built on Jan. 19, 2022, 5:08 p.m.