1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/checkNull.R
\name{checkNull}
\alias{checkNull}
\alias{check_null}
\alias{assertNull}
\alias{assert_null}
\alias{testNull}
\alias{test_null}
\title{Check if an argument is NULL}
\usage{
checkNull(x)
check_null(x)
assertNull(x, .var.name = vname(x), add = NULL)
assert_null(x, .var.name = vname(x), add = NULL)
testNull(x)
test_null(x)
}
\arguments{
\item{x}{[any]\cr
Object to check.}
\item{.var.name}{[\code{character(1)}]\cr
Name of the checked object to print in assertions. Defaults to
the heuristic implemented in \code{\link{vname}}.}
\item{add}{[\code{AssertCollection}]\cr
Collection to store assertion messages. See \code{\link{AssertCollection}}.}
}
\value{
Depending on the function prefix:
If the check is successful, the functions
\code{assertNull}/\code{assert_null} return
\code{x} invisibly, whereas
\code{checkNull}/\code{check_null} and
\code{testNull}/\code{test_null} return
\code{TRUE}.
If the check is not successful,
\code{assertNull}/\code{assert_null}
throws an error message,
\code{testNull}/\code{test_null}
returns \code{FALSE},
and \code{checkNull}/\code{check_null}
return a string with the error message.
The function \code{expect_null} always returns an
\code{\link[testthat]{expectation}}.
}
\description{
Check if an argument is NULL
}
\examples{
testNull(NULL)
testNull(1)
}
\seealso{
Other basetypes:
\code{\link{checkArray}()},
\code{\link{checkAtomic}()},
\code{\link{checkAtomicVector}()},
\code{\link{checkCharacter}()},
\code{\link{checkComplex}()},
\code{\link{checkDataFrame}()},
\code{\link{checkDate}()},
\code{\link{checkDouble}()},
\code{\link{checkEnvironment}()},
\code{\link{checkFactor}()},
\code{\link{checkFormula}()},
\code{\link{checkFunction}()},
\code{\link{checkInteger}()},
\code{\link{checkIntegerish}()},
\code{\link{checkList}()},
\code{\link{checkLogical}()},
\code{\link{checkMatrix}()},
\code{\link{checkNumeric}()},
\code{\link{checkPOSIXct}()},
\code{\link{checkRaw}()},
\code{\link{checkVector}()}
}
\concept{basetypes}
|