Skip to contents

A test that registers a covariance structure, a residual correlation term, an addition term, a family's compatibility rows, a frame check or a prior default calls frmtmb_local_registries() first. When env exits (the end of the test_that() block), every registry is put back as it was, so the registration cannot reach the tests after it: R CMD check and covr run every file of a suite in one session.

Usage

frmtmb_local_registries(env = parent.frame())

Arguments

env

The environment whose exit restores the registries; the default is the caller's, which in a test_that() block is the test.

Value

The saved state, invisibly. Called for the restore it schedules.

Details

The restore puts back what it found. It never deletes an entry by name, because the name may belong to a package that was loaded before the test. A frmtmb package that loads inside the scope keeps its registrations: after the restore, the .onLoad() of every frmtmb.* namespace that appeared in the scope runs again, in the order they loaded.

Examples

f <- function() {
  frmtmb_local_registries()
  # a registration here is undone when f() returns
  invisible(NULL)
}
f()