tests/testthat/test-utils_language.R

tar_test("tar_sub_body()", {
  skip_cran()
  fun <- function(object, path) {
    saveRDS(object, path, version = version)
  }
  out <- tar_sub_body(fun, list(version = 3))
  expect_equal(names(formals(out)), c("object", "path"))
  expect_equal(
    setdiff(trimws(deparse(body(out))), c("{", "}")),
    "saveRDS(object, path, version = 3)"
  )
})

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.