tests/testthat/test-tar_branch_names.R

tar_test("tar_branch_names()", {
  skip_cran()
  tar_script(
    {
      list(
        tar_target(w, 1),
        tar_target(x, seq_len(4)),
        tar_target(y, 2 * x, pattern = map(x)),
        tar_target(z, y, pattern = map(y))
      )
    },
    ask = FALSE
  )
  tar_make(callr_function = NULL)
  out <- tar_branch_names(z, c(2, 3))
  exp <- tar_meta(z, children)$children[[1]][c(2, 3)]
  expect_equal(out, exp)
})

Try the targets package in your browser

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

targets documentation built on Sept. 13, 2025, 9:08 a.m.