initTestthat {FastUtils}R Documentation

Initialize Testthat Files

Description

This function scans all files in the specified R directory based on its name, excluding some based on the patterns provided in the ignore argument, and creates testthat files if they are missing. Useful for when many source code files were created from rapid development and unit testing has yet to be setup.

Usage

initTestthat(
  rDir = "R",
  testDir = "tests/testthat",
  .ignore = c("-package.R$", "-class.R$", "^data.R$", "^zzz.R$", "^RcppExports.R$"),
  ignore = NULL
)

Arguments

rDir

The directory containing R source files. Default is "R".

testDir

The directory where testthat files should be created. Default is "tests/testthat".

.ignore

A character vector specifying regex patterns of files to ignore. Defaults to common patterns c("-package.R$", "-class.R$", "^data.R$", "^zzz.R$", "^RcppExports.R$")

ignore

A character vector of extra regex patterns of R files to ignore

Value

No return value, called for side effects.

Examples


try({

initTestthat()
initTestthat(rDir = "src", testDir = "tests")
initTestthat(ignore = c("^foo", "-bar.R$"))

}, silent = TRUE)



[Package FastUtils version 0.1.1 Index]