File: expectation.Rd

package info (click to toggle)
r-cran-testthat 3.2.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 3,452 kB
  • sloc: cpp: 9,261; ansic: 37; sh: 14; makefile: 5
file content (53 lines) | stat: -rw-r--r-- 1,430 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/expectation.R
\name{expectation}
\alias{expectation}
\alias{new_expectation}
\alias{exp_signal}
\alias{is.expectation}
\title{Construct an expectation object}
\usage{
expectation(type, message, srcref = NULL, trace = NULL)

new_expectation(
  type,
  message,
  ...,
  srcref = NULL,
  trace = NULL,
  .subclass = NULL
)

exp_signal(exp)

is.expectation(x)
}
\arguments{
\item{type}{Expectation type. Must be one of "success", "failure", "error",
"skip", "warning".}

\item{message}{Message describing test failure}

\item{srcref}{Optional \code{srcref} giving location of test.}

\item{trace}{An optional backtrace created by \code{\link[rlang:trace_back]{rlang::trace_back()}}.
When supplied, the expectation is displayed with the backtrace.}

\item{...}{Additional attributes for the expectation object.}

\item{.subclass}{An optional subclass for the expectation object.}

\item{exp}{An expectation object, as created by
\code{\link[=new_expectation]{new_expectation()}}.}

\item{x}{object to test for class membership}
}
\description{
For advanced use only. If you are creating your own expectation, you should
call \code{\link[=expect]{expect()}} instead. See \code{vignette("custom-expectation")} for more
details.
}
\details{
Create an expectation with \code{expectation()} or \code{new_expectation()}
and signal it with \code{exp_signal()}.
}