Skip to contents

@expectRaw creates an expectation for your example code, without adding the next expression as the subject.

Details

@expectRaw creates a testthat expectation. Unlike @expect, it doesn't insert the subsequent expression as the first argument.

#' @doctest
#'
#' x <- 2 + 2
#' @expectRaw equals(x, 4)
#'
#' f <- function () warning("Watch out")
#' @expectRaw warning(f())

Don't include the expect_ prefix.

The @expectRaw tag and code must fit on a single line.

See also

Other expectations: expect-tag, snap-tag