tests/testthat/test-options.R

test_that("merged options from can load options from DESCRIPTION", {
  opts <- load_options(test_path("test-options"))
  expect_equal(opts$old_usage, TRUE) # from DESCRIPTION
  expect_equal(opts$markdown, TRUE) # from meta.R
})

test_that("warns on invalid meta.R files", {

  expect_warning(
    load_options_meta(test_path("test-options"), "meta-error.R"),
    "Failed to source"
  )

  expect_warning(
    load_options_meta(test_path("test-options"), "meta-character.R"),
    "yield a named list"
  )
})

Try the roxygen2 package in your browser

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

roxygen2 documentation built on Sept. 8, 2021, 9:08 a.m.