Learn R Programming

testthat (version 0.2)

throws_error: Expectation: does expression throw an error?

Description

Expectation: does expression throw an error?

Usage

throws_error(regexp)

Arguments

regexp
optional regular expression to match. If not specified, just asserts that expression throws some error.

Examples

Run this code
expect_that(log("a"), throws_error())
expect_that(log("a"), throws_error("Non-numeric argument"))

Run the code above in your browser using DataLab