tests/testthat/test-tar_canceled.R

tar_test("tar_canceled() empty", {
  expect_equal(tar_canceled(), character(0))
  expect_equal(tar_canceled(contains("x")), character(0))
})

tar_test("tar_canceled() nonempty", {
  skip_cran()
  tar_script(list(tar_target(x, tar_cancel()), tar_target(y, tar_cancel())))
  tar_make(callr_function = NULL)
  expect_equal(sort(tar_canceled()), sort(c("x", "y")))
  expect_equal(tar_canceled(contains("x")), "x")
})

Try the targets package in your browser

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

targets documentation built on Oct. 12, 2023, 5:07 p.m.