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
|
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/expectations.R
\name{expect_match}
\alias{expect_match}
\title{Match strings to a regular expression}
\usage{
expect_match(current, pattern, info = NA_character_, ...)
}
\arguments{
\item{current}{\code{[character]} String(s) to check for \code{pattern}.}
\item{pattern}{\code{[character]} A regular expression.}
\item{info}{\code{[character]} scalar. Optional user-defined message. Must
be a single character string. Multiline comments may be separated by
\code{"\\n"}.}
\item{...}{passed to \code{\link[base]{grepl}}}
}
\description{
Results in \code{TRUE} only when all elements of current match the regular
expression in \code{pattern}. Matching is done by \code{\link[base]{grepl}}.
}
\examples{
expect_match("hello world", "world") # TRUE
expect_match("hello world", "^world$") # FALSE
expect_match("HelLO woRlD", "world", ignore.case=TRUE) # TRUE
expect_match(c("apple","banana"), "a") # TRUE
expect_match(c("apple","banana"), "b") # FALSE
}
\seealso{
Other test-functions:
\code{\link{expect_equal_to_reference}()},
\code{\link{expect_equal}()},
\code{\link{expect_length}()},
\code{\link{ignore}()}
}
\concept{test-functions}
|