tests/testthat/test-options.R

test_that("checkOptions() works", {
  withr::local_options(list(mark.test.option1 = 1L, mark.test.option2 = 2L))

  expect_message(
    checkOptions(list(mark.test.option1 = 2L, mark.test.option2 = 3L))
  )

  expect_identical(getOption("mark.test.option1"), 1L)
  expect_identical(getOption("mark.test.option2"), 2L)

  expect_error(checkOptions(1), info = "is.list(x)")
  expect_error(checkOptions(list(1)), class = "checkOptionsNamesError")
})

Try the mark package in your browser

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

mark documentation built on May 29, 2024, 5:13 a.m.