expect_equivalent: Is an object equal to the expected value, ignoring...

Description Usage Arguments 3rd edition Examples

View source: R/expect-equality.R

Description

Compares object and expected using all.equal() and check.attributes = FALSE.

Usage

1
2
3
4
5
6
7
8
expect_equivalent(
  object,
  expected,
  ...,
  info = NULL,
  label = NULL,
  expected.label = NULL
)

Arguments

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 quasi_label for more details.

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 quasi_label for more details.

...

Passed on to compare().

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 quasi_label.

label

Used to customise failure messages. For expert use only.

expected.label

Used to customise failure messages. For expert use only.

3rd edition

[Deprecated]

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

Examples

1
2
3
4
5
6
7
8
#' # expect_equivalent() ignores attributes
a <- b <- 1:3
names(b) <- letters[1:3]
## Not run: 
expect_equal(a, b)

## End(Not run)
expect_equivalent(a, b)

r-lib/testthat documentation built on Sept. 25, 2021, 3:02 p.m.