The function unit.test provides a way to write unit tests embedded within package source files. These tests are stored and organised in the package namespace, and can be run using the unified interface provided by the function link{utest}. Both Runit and testthat tests are supported -- and automatically detected.

unit.test(x, expr, framework = NULL, envir = parent.frame())

Arguments

x

single character string used as test identifier/label

expr

expression containing the actual test commands. It is not evaluated, but only stored in the package namespace.

framework

Unit test framework

envir

the definition environment of object x.

Value

a test function with no arguments that wrapping around expr