ExpectWarning: ExpectWarning

View source: R/warnings.R

ExpectWarningR Documentation

ExpectWarning

Description

Checks to see if the printing of an object causes warnings to appear.

Usage

ExpectWarning(code, string)

Arguments

code

The code to evaluate for warnings.

string

The string of text to be searched for in the warnings.

Value

Returns NULL. Throws an exception if the code is evaluated and no warning is thrown or the string does not appear in the warning.

Examples

throwsAWarning <- function()
{
    warning("This is a warning")
}
ExpectWarning(throwsAWarning(), "a warning")

NumbersInternational/flipU documentation built on March 2, 2024, 10:55 a.m.