writeRUnitRunner: Write an R code file containing a .test function to run RUnit...

View source: R/writeRUnitRunner.R

writeRUnitRunnerR Documentation

Write an R code file containing a .test function to run RUnit tests

Description

This function generates an R code file containing a single function .test that can be used to run the RUnit unit tests of a package. The generated .test function is customized for the specified package and takes care of setting up RUnit options, configuring the location of unit test files, and generating helpful summary data when tests fail.

Usage

writeRUnitRunner(pkg, file = "runit_runner.R")

Arguments

pkg

Package name: a .test function will be generated customized for the specified package name.

file

Determines the file where code for the .test function will be written.

Details

Copy the generated file, or its contents, into your package source. You can add an additional R script in pkg/tests that loads your package and then calls pkg:::.test(). This will ensure that unit tests are run during R CMD check and that a unit test failure will result in an ERROR report from R CMD check.

Value

Called for the side-effect of creating a file containing the .test function definition customized for pkg.

Author(s)

Seth Falcon

Examples

  tf <- tempfile()
  writeRUnitRunner("foo", tf)
  lines <- readLines(tf)
  file.remove(tf)

Bioconductor/codetoolsBioC documentation built on April 25, 2023, 11:05 a.m.