tests/testthat/test-examples-smoke.R

test_that("a couple of examples run (smoke test)", {
      skip_on_cran()
      topics <- tryCatch(help(package = "tester")$info[[1L]][, "Topic"], error = function(e) character())
      if (length(topics)) {
        topics <- head(setdiff(topics, c("NULL", "internal")), 2L)
        for (tp in topics) {
          expect_error(
            example(topic = tp, package = "tester", character.only = TRUE, run.donttest = TRUE,
                    give.lines = FALSE, echo = FALSE),
            NA, info = paste("Example failed for", tp)
          )
        }
      } else {
        succeed("No topics with examples found.")
      }
    })

Try the tester package in your browser

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

tester documentation built on Nov. 6, 2025, 1:14 a.m.