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)
})

Try the onetime package in your browser

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

onetime documentation built on Sept. 3, 2023, 9:06 a.m.