A family of functions for managing globally registered variant() objects
across all HTEST_FN-based functions for the duration of the session.
Arguments
- test
A test function built with
HTEST_FN(), e.g. TTEST.- name
A string naming the variant to add or replace.
- impl
A
variant()object.- origin
One of
"user"(default, session-scoped) or"package"(permanent, intended for.onLoad()).- cls
A string naming the test class to clear (e.g.
"ttest"). WhenNULL(default), all globally registered variants are cleared.
Value
plug_variant(), swap_variant(), and clear_htest_defs() return
NULL invisibly, called for their side effects.
get_htest_defs() returns a list of test_define() objects, or an
empty list if none have been registered for the given cls.
Functions
plug_variant(): Adds a new namedvariant()to an existing test function. Hard-errors if the name already exists or if name is"default".swap_variant(): Replaces an existing namedvariant(). Hard-errors if the name does not exist or if name is"default".clear_htest_defs(): Resets globally registered variants, either fully or scoped to a specificcls. Only"user"-originated entries are removed —"package"entries are always preserved.
Precedence
Globally registered variants sit between built-in definitions and the pipeline. The full priority order, from lowest to highest, is:
Built-in variants (declared inside HTEST_FN)
Global variants registered via
plug_variant()orswap_variant()