R: Expect that a condition holds.

expect_that {testthat} | R Documentation

## Expect that a condition holds.

### Description

An old style of testing that's no longer encouraged.

### Usage

    expect_that(object, condition, info = NULL, label = NULL)

### Arguments

`object` | object to test
`condition,` | a function that returns whether or not the condition is met, and if not, an error message to display.
`info` | extra information to be included in the message (useful when writing tests in loops).
`label` | object label. When `NULL`, computed from deparsed object.

### Value

the (internal) expectation result as an invisible list

### See Also

`fail` for an expectation that always fails.

### Examples

    expect_that(5 * 2, equals(10))
    expect_that(sqrt(2) ^ 2, equals(2))
    ## Not run:
    expect_that(sqrt(2) ^ 2, is_identical_to(2))

    ## End(Not run)

[Package testthat version 1.0.2 Index]