A convenience wrapper around testthat::expect_snapshot() and
expect_pkg_message_classes() that captures both the message class hierarchy
and the user-facing message in a single snapshot.
Usage
expect_pkg_message_snapshot(
object,
package,
...,
transform = NULL,
variant = NULL,
env = caller_env()
)Arguments
- object
An expression that is expected to throw a message.
- package
(length-1 character)The name of the package to use in classes.- ...
(character)Components of the class name, from least-specific to most.- transform
(
functionorNULL) Optional function to scrub volatile output (e.g. temp paths) before snapshot comparison. Passed through totestthat::expect_snapshot().- variant
(
character(1)orNULL) Optional snapshot variant name. Passed through totestthat::expect_snapshot().- env
(
environment) The environment in whichobjectshould be evaluated. Assignments made insideobjectare visible to the caller after this function returns.expect_pkg_message_classes()is temporarily injected intoenvif it is not already findable, so this works even when this package is not attached.
Value
The result of testthat::expect_snapshot(), invisibly.