tests/testthat/pathResolver.R

computeRootPath <- function() {
  g <- getwd()

  # for Rcheck
  if (grepl('.Rcheck', g, fixed = TRUE))
    return(system.file(package = "wyz.code.offensiveProgramming"))

  # for covr - must be done prior test for testthat
  if (grepl('wyz.code.offensiveProgramming-tests/testthat', g, fixed = TRUE))
    return(system.file(package = "wyz.code.offensiveProgramming"))

  # for testthat
  if (grepl('tests/testthat', g, fixed = TRUE))
    return(normalizePath(file.path(g, '../../inst')))

  '.'
}

Try the wyz.code.offensiveProgramming package in your browser

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

wyz.code.offensiveProgramming documentation built on Sept. 25, 2023, 9:05 a.m.