Expectation: does string match a regular expression?
expect_match(object, regexp, perl = FALSE, fixed = FALSE, ..., all = TRUE, info = NULL, label = NULL)
object | object to test |
---|---|
regexp | Regular expression to test against. |
perl | logical. Should Perl-compatible regexps be used? |
fixed | logical. If |
... | Arguments passed on to
|
all | Should all elements of actual value match |
info | extra information to be included in the message (useful when writing tests in loops). |
label | object label. When |
Other expectations: comparison-expectations
,
equality-expectations
,
expect_length
, expect_named
,
inheritance-expectations
,
logical-expectations
,
output-expectations
expect_match("Testing is fun", "fun") expect_match("Testing is fun", "f.n")# NOT RUN { expect_match("Testing is fun", "horrible") # Zero-length inputs always fail expect_match(character(), ".") # }