Learn R Programming

AnalysisPageServer (version 1.6.2)

dies.ok: dies.ok

Description

Test that an expression throws an error

Usage

dies.ok(call, regex, testname)

Arguments

call
An expression to evaluate
regex
A regular expression to match the error against. If omitted then don't test the exception text.
testname
A name for the test. Defaults to deparsing the call.

Value

Runs one or two tests (the second test to match the error message against regex, if it was provided and if an error was successfully thrown).

Details

Test that an expression throws an error.

Examples

Run this code
dies.ok(stop("foo"), "foo", "it stops")

Run the code above in your browser using DataLab