tests/testthat/test-tar_older.R

tar_test("tar_older() works", {
  tar_script(tar_target(x, 1))
  tar_make(callr_function = NULL)
  early <- Sys.time() - as.difftime(1, units = "weeks")
  late <- Sys.time() + as.difftime(1, units = "weeks")
  expect_equal(tar_older(early), character(0))
  expect_equal(tar_older(late), "x")
  expect_equal(tar_older(late, names = any_of("y")), character(0))
})

Try the targets package in your browser

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

targets documentation built on Oct. 3, 2024, 1:11 a.m.