Skip to contents

@snap creates a snapshot test for your example. It is shorthand for @expect snapshot().

Details

Often, examples show complex output to the user. If this output changes, you want to check that it still "looks right". Snapshot tests help by failing when the output changes, and allowing you to review and approve the new output.

#' @doctest
#'
#' @snap
#' summary(lm(Petal.Width ~ Species, data = iris))

See also

Other expectations: expect-tag, expectRaw-tag