Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions googletest/src/matchers/subset_of_matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,22 @@ use std::fmt::Debug;
/// # should_pass().unwrap();
/// ```
///
/// Using variables of standard library collections requires matching item
/// reference types:
///
/// ```
/// # use googletest::prelude::*;
/// # fn should_pass() -> Result<()> {
/// let set_x = vec![1, 2, 3];
/// let set_y = vec![2, 3];
///
/// // Borrow the elements of the expected container to match reference types
/// let expected: Vec<&i32> = set_x.iter().collect();
/// verify_that!(set_y, subset_of(expected))?;
/// # Ok(())
/// # }
/// # should_pass().unwrap();
/// ```
/// A note on performance: This matcher uses a naive algorithm with a worst-case
/// runtime proportional to the *product* of the sizes of the actual and
/// expected containers as well as the time to check equality of each pair of
Expand Down