Skip to content

For advanced use only. If you are creating your own expectation, you should call pass() or fail(). See vignette("custom-expectation") for more details.

new_expectation() creates an expectation object and exp_signal() signals it. expectation() does both.

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

type

Expectation type. Must be one of "success", "failure", "error", "skip", "warning".

message

Message describing test failure

...

Additional attributes for the expectation object.

srcref

Optional srcref giving location of test.

trace

An optional backtrace created by rlang::trace_back(). When supplied, the expectation is displayed with the backtrace. Expert use only.

.subclass

An optional subclass for the expectation object.

exp

An expectation object, as created by new_expectation().

x

object to test for class membership