tests/testthat/test-reset.R

test_that("reset deletes reproducibility files", {
  tmp <- tempfile()
  dir.create(tmp)
  oldwd <- setwd(tmp)
  on.exit(setwd(oldwd), add = TRUE)

  prefix <- default_prefix()
  filetype <- default_filetype()

  f1 <- file.path(tmp, paste0(prefix, "_test1.", filetype))
  f2 <- file.path(tmp, paste0(prefix, "_test2.", filetype))
  file.create(f1)
  file.create(f2)

  expect_true(all(file.exists(c(f1, f2))))

  reproducibleRchunks::reset()

  expect_false(any(file.exists(c(f1, f2))))
})

Try the reproducibleRchunks package in your browser

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

reproducibleRchunks documentation built on Aug. 8, 2025, 6:38 p.m.