| expect_match {testthat} | R Documentation |
Expectation: does string/output/message/warning/error match a regular expression?
expect_match(object, regexp, ..., all = TRUE, info = NULL, label = NULL)
object |
object to test |
regexp |
Regular expression to test against. |
... |
Additional 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_equal_to_reference,
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(), ".")
## End(Not run)