check_that: Expectation wrapper

View source: R/check-that.R

check_thatR Documentation

Expectation wrapper

Description

This function wraps around an is_... function. When the expectation fails to be met, the feedback message is sent to the reporter. You can use is_true, is_false, is_gte or is_equal

Usage

check_that(code, feedback, env = parent.frame())

test_what(code, feedback)

Arguments

code

The expectation that should be wrapped

feedback

A character string with feedback when the expection is not met OR a list object, containing multiple pieces of information. This list should at least contain an element named message

env

environment in which the test should be evaluated; defaults to parent.frame()

Examples

## Not run: 
check_that(is_true(3 == 3))
check_that(is_false(3 == 4))
check_that(is_gte(4, 3))
check_that(is_equal(4, 4))

## End(Not run)

datacamp/testwhat documentation built on June 26, 2022, 9:07 a.m.