Learn R Programming

testthat (version 0.3)

gives_warning: Expectation: does expression give a warning?

Description

Expectation: does expression give a warning?

Usage

gives_warning(regexp)

Arguments

regexp
optional regular expression to match. If not specified, just asserts that expression gives some warning.

Details

Needs to match at least one of the warnings produced by the expression.

Examples

Run this code
expect_that(warning("a"), gives_warning())
expect_that(warning("a"), gives_warning("a"))

Run the code above in your browser using DataLab