tests/testthat/test-doctest-onetime_only.R

# Generated by doctest: do not edit by hand
# Please edit file in R/onetime.R

test_that("Doctest: onetime_only", {
  # Created from @doctest for `onetime_only`
  # Source file: R/onetime.R
  # Source line: 95
  oo <- options(onetime.dir = tempdir(check = TRUE))
  id <- sample(10000L, 1)
  sample_once <- onetime_only(sample, id = id)
  expect_length(sample_once(1:10), 10)
  expect_null(sample_once(1:10))
  onetime_reset(id)
  options(oo)
})
hughjonesd/onetime documentation built on Jan. 24, 2025, 2:49 p.m.