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_false(any(duplicated(checks)))
})

Try the goodpractice package in your browser

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

goodpractice documentation built on June 22, 2024, 9:55 a.m.