File: expect_equivalent.Rd

package info (click to toggle)
r-cran-testthat 3.0.1-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,996 kB
  • sloc: cpp: 9,265; ansic: 37; sh: 15; makefile: 5
file content (62 lines) | stat: -rw-r--r-- 1,739 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
54
55
56
57
58
59
60
61
62
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/expect-equality.R
\name{expect_equivalent}
\alias{expect_equivalent}
\title{Is an object equal to the expected value, ignoring attributes?}
\usage{
expect_equivalent(
  object,
  expected,
  ...,
  info = NULL,
  label = NULL,
  expected.label = NULL
)
}
\arguments{
\item{object}{Computation and value to compare it to.

Both arguments supports limited unquoting to make it easier to generate
readable failures within a function or for loop. See \link{quasi_label} for
more details.}

\item{expected}{Computation and value to compare it to.

Both arguments supports limited unquoting to make it easier to generate
readable failures within a function or for loop. See \link{quasi_label} for
more details.}

\item{...}{Passed on to \code{\link[=compare]{compare()}}.}

\item{info}{Extra information to be included in the message. This argument
is soft-deprecated and should not be used in new code. Instead see
alternatives in \link{quasi_label}.}

\item{label}{Used to customise failure messages. For expert
use only.}

\item{expected.label}{Used to customise failure messages. For expert
use only.}
}
\description{
Compares \code{object} and \code{expected} using \code{\link[=all.equal]{all.equal()}} and
\code{check.attributes = FALSE}.
}
\section{3rd edition}{

\ifelse{html}{\figure{lifecycle-deprecated.svg}{options: alt='Deprecated lifecycle'}}{\strong{Deprecated}}

\code{expect_equivalent()} is deprecated in the 3rd edition. Instead use
\code{expect_equal(ignore_attr = TRUE)}.
}

\examples{
#' # expect_equivalent() ignores attributes
a <- b <- 1:3
names(b) <- letters[1:3]
\dontrun{
expect_equal(a, b)
}
expect_equivalent(a, b)
}
\keyword{internal}