View source: R/writeRUnitRunner.R
writeRUnitRunner | R Documentation |
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.
writeRUnitRunner(pkg, file = "runit_runner.R")
pkg |
Package name: a |
file |
Determines the file where
code for the |
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.
Called for the side-effect of creating a file containing the
.test
function definition customized for pkg
.
Seth Falcon
tf <- tempfile()
writeRUnitRunner("foo", tf)
lines <- readLines(tf)
file.remove(tf)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.