tests/testthat/test-integrity.R

test_that("checks are not overwritten", {
  skip_on_cran()

  pkgdir <- file.path("..", "..", "R")
  rfiles <- list.files(pkgdir, full.names = TRUE)
  rlines <- as.character(unlist(lapply(rfiles, readLines)))
  rwords <- unlist(strsplit(rlines, "\\s+"))
  checks <- grep("CHECKS$", rwords, fixed = TRUE, value = TRUE)
  expect_identical(anyDuplicated(checks), 0L)
})

Try the goodpractice package in your browser

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

goodpractice documentation built on June 5, 2026, 5:06 p.m.