Function googletest::matchers::contains_regex
source ยท pub fn contains_regex<PatternT: Deref<Target = str>>(
pattern: PatternT,
) -> ContainsRegexMatcher
Expand description
Matches a string containing a substring which matches the given regular expression.
Both the actual value and the expected regular expression may be either a
String
or a string reference.
verify_that!("Some value", contains_regex("S.*e"))?; // Passes
verify_that!("Another value", contains_regex("Some"))?; // Fails
verify_that!("Some value".to_string(), contains_regex("v.*e"))?; // Passes
verify_that!("Some value", contains_regex("v.*e".to_string()))?; // Passes
Panics if the given pattern
is not a syntactically valid regular
expression.