
Last chance! 50% off unlimited learning
Sale ends in
An old style of testing that's no longer encouraged.
expect_that(object, condition, info = NULL, label = NULL)
the (internal) expectation result as an invisible list
Object to test.
Supports limited unquoting to make it easier to generate readable failures within a function or for loop. See quasi_label for more details.
a function that returns whether or not the condition is met, and if not, an error message to display.
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.
Used to customise failure messages. For expert use only.
fail()
for an expectation that always fails.
expect_that(5 * 2, equals(10))
expect_that(sqrt(2) ^ 2, equals(2))
if (FALSE) {
expect_that(sqrt(2) ^ 2, is_identical_to(2))
}
Run the code above in your browser using DataLab