tests/testthat/test_sleep.R

test_that("getSleepFunction", {
  reg = makeTestRegistry()
  f = getSleepFunction(reg, NULL)
  expect_function(f)
  expect_true(any(grepl("Sys.sleep", as.character(body(f)))))

  f = getSleepFunction(reg, 99)
  expect_function(f)
  expect_true(any(grepl("Sys.sleep", as.character(body(f)))))

  f = getSleepFunction(reg, function(x) x^2)
  expect_function(f)
  expect_true(any(grepl("Sys.sleep", as.character(body(f)))))
})

Try the batchtools package in your browser

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

batchtools documentation built on April 20, 2023, 5:09 p.m.