expect_match {tinytest} | R Documentation |
Match strings to a regular expression
Description
Results in TRUE
only when all elements of current match the regular
expression in pattern
. Matching is done by grepl
.
Usage
expect_match(current, pattern, info = NA_character_, ...)
Arguments
current |
|
pattern |
|
info |
|
... |
passed to |
See Also
Other test-functions:
expect_equal_to_reference()
,
expect_equal()
,
expect_length()
,
ignore()
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
[Package tinytest version 1.4.1 Index]