expectRaw-tag: Create an expectation as-is

expectRaw-tagR Documentation

Create an expectation as-is

Description

⁠@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


doctest documentation built on May 29, 2024, 7:09 a.m.