tests/testthat/test-package-startup.R

test_that("non-interactive attach does not emit startup messages", {
  testthat::local_mocked_bindings(
    interactive = function() FALSE,
    .package = "base"
  )

  expect_silent(thisutils:::.onAttach(NULL, "thisutils"))
})

test_that("interactive attach honors verbose = FALSE", {
  old <- options(log_message.verbose = FALSE)
  on.exit(options(old), add = TRUE)

  testthat::local_mocked_bindings(
    interactive = function() TRUE,
    .package = "base"
  )

  expect_silent(thisutils:::.onAttach(NULL, "thisutils"))
})

Try the thisutils package in your browser

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

thisutils documentation built on May 24, 2026, 5:07 p.m.