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")
})
jmbarbone/jordan documentation built on April 1, 2024, 7:46 p.m.