register_tinytest_extension {tinytest}R Documentation

Register or unregister extension functions

Description

Functions to use in .onLoad and .onUnload by packages that extend tinytest.

Usage

register_tinytest_extension(pkg, functions)

Arguments

pkg

[character] scalar. Name of the package providing extensions.

functions

[character] vector. Name of the functions in the package that must be added.

The tinytest API

Packages can extend tinytest with expectation functions if and only if the following requirements are satisfied.

  1. The extending functions return a tinytest object. This can be created by calling tinytest() with the arguments (defaults, if any, are in brackets):

    Observe that this requires the extending package to add tinytest to the Imports field in the package's DESCRIPTION file (this also holds for the following requirement).

  2. Functions are registered in .onLoad() using register_tinytest_extension(). Functions that are already registered, including tinytest functions will be overwritten.

It is recommended to:

  1. Follow the syntax conventions of tinytest so expectation functions start with expect_.

  2. Explain to users of the extension package how to use the extension (see using).

  3. include an info argument to expect_ functions that is passed to tinytest().

Minimal example packages

See Also

Other extensions: tinytest(), using()


[Package tinytest version 1.2.4 Index]