tests/testthat/test-prism_check_dl_dir.R

# unable to test the interactive mode, but can check that it fails when not set
# and not interactive, or works wehn set

orig_prism_path <- getOption("prism.path")
teardown(options(prism.path = orig_prism_path))

prism_set_dl_dir(tempdir())

test_that("prism_check_dl_dir() works if path is set", {
  expect_equal(prism_check_dl_dir(), tempdir())
  expect_warning(expect_equal(path_check(), tempdir()))
})

options(prism.path = NULL)
test_that("prism_check_dl_dir() fails if path is not set", {
  expect_error(prism_check_dl_dir())
})

Try the prism package in your browser

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

prism documentation built on Oct. 18, 2023, 9:09 a.m.