| expect-tag {doctest} | R Documentation |
Create an expectation
Description
@expect creates an expectation for your example code.
Details
Use @expect to create a testthat expectation.
#' @doctest
#'
#' @expect equals(4)
#' 2 + 2
#'
#' f <- function () warning("Watch out")
#' @expect warning()
#' f()
The next expression will be inserted as the first
argument to the expect_* call.
Don't include the expect_ prefix.
If you want to include the expression in a different
place or places, use a dot .:
@expect equals(., rev(.))
c("T", "E", "N", "E", "T")
The @expect tag and code must fit on a single line.
See Also
Other expectations:
expectRaw-tag,
snap-tag
[Package doctest version 0.3.0 Index]