Learn R Programming

tinytest (version 0.9.4)

test_package: Test a package during R CMD check

Description

Run all tests in a package. Throw an error and print all failed test results when one or more tests fail. This function is intended to be used with R CMD check and not for interactive use (use test_all or build_install_test instead). Tests that are only run at_home are skipped by default (as if it was run on CRAN).

Usage

test_package(pkgname, testdir = "tinytest", at_home = FALSE, ...)

Arguments

pkgname

[character] scalar. Name of the package

testdir

[character] scalar. Path to installed directory, relative to the working directory of R CMD check.

at_home

[logical] scalar. Are we at home? (see Details)

...

extra arguments, passed to run_test_dir

Details

We set at_home=FALSE by default so R CMD check will run the same as at CRAN.

See Also

setup_tinytest

Other test-files: build_install_test, run_test_dir, run_test_file, summary.tinytests

Examples

Run this code
# NOT RUN {
# Create a file with the following content, to use
# tinytest as your unit testing framework:
  if (requireNamespace("tinytest", quietly=TRUE))
    test_package("your package name")
# }

Run the code above in your browser using DataLab