tests/testthat/test-zzz.R

test_that("set_seekr_verbose_default() sets default only when option is unset", {
  original = getOption("seekr.verbose")
  on.exit(options(seekr.verbose = original), add = TRUE)

  # Case 1: Option is unset → should be set to interactive()
  withr::with_options(list(seekr.verbose = NULL), {
    expect_null(getOption("seekr.verbose"))
    set_seekr_verbose_default()
    expect_identical(getOption("seekr.verbose"), interactive())
  })

  # Case 2: Option is already set → should remain unchanged
  withr::with_options(list(seekr.verbose = FALSE), {
    expect_false(getOption("seekr.verbose"))
    set_seekr_verbose_default()
    expect_identical(getOption("seekr.verbose"), FALSE)
  })
})


test_that(".onLoad() executes without error", {
  expect_silent(.onLoad("seekr", "seekr"))
})

Try the seekr package in your browser

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

seekr documentation built on June 8, 2025, 11:13 a.m.