assert_contains() checks that an output field contains pattern,
matched as a fixed string, not a regular expression. Use
assert_matches() for regular expressions.
Usage
assert_contains(
field = NULL,
pattern,
ignore_case = FALSE,
type = c("assert", "suggest")
)Arguments
- field
The output field to check. With
NULL, the whole output is checked, which suits outputs with a single field. A missing field fails the check.- pattern
The string that must appear.
- ignore_case
If
TRUE, ignore case when matching.- type
"assert"(the default) for a hard assertion, which makeswith_assertions()retry when it fails, or"suggest"for a soft one, which only gives a warning.
Value
An assertion for assertion_set() or with_assertions().