% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/testit.R
\name{has_warning}
\alias{has_warning}
\alias{has_error}
\title{Check if an R expression produces warnings or errors}
\usage{
has_warning(expr)

has_error(expr, silent = !interactive())
}
\arguments{
\item{expr}{an R expression}

\item{silent}{logical: should the report of error messages be suppressed?}
}
\value{
A logical value.
}
\description{
The two functions \code{has_warning()} and \code{has_error()} check if an
expression produces warnings and errors, respectively.
}
\examples{
has_warning(1 + 1)
has_warning(1:2 + 1:3)

has_error(2 - 3)
has_error(1 + "a")
has_error(stop("err"), silent = TRUE)
}
