Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

expect_reference

Does code return a reference to the expected object?


Description

expect_reference() compares the underlying memory addresses of two symbols. It is for expert use only.

Usage

expect_reference(
  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.

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_reference() is deprecated in the third edition. If you know what you're doing, and you really need this behaviour, just use is_reference() directly: expect_true(rlang::is_reference(x, y)).

See Also


testthat

Unit Testing for R

v3.0.2
MIT + file LICENSE
Authors
Hadley Wickham [aut, cre], RStudio [cph, fnd], R Core team [ctb] (Implementation of utils::recover())
Initial release

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.