Function googletest::matchers::contains
source · pub fn contains<T, InnerMatcherT>(
inner: InnerMatcherT
) -> ContainsMatcher<T, InnerMatcherT>
Expand description
Matches an iterable type whose elements contain a value matched by inner
.
By default, this matches a container with any number of elements matched
by inner
. Use the method ContainsMatcher::times
to constrain the
matched containers to a specific number of matching elements.
verify_that!(["Some value"], contains(eq("Some value")))?; // Passes
verify_that!(vec!["Some value"], contains(eq("Some value")))?; // Passes
verify_that!([] as [String; 0], contains(eq("Some value")))?; // Fails
verify_that!(["Some value"], contains(eq("Some other value")))?; // Fails