unordered_elements_are

Macro unordered_elements_are 

Source
macro_rules! unordered_elements_are {
    ($(,)?) => { ... };
    ($($matcher:expr),* $(,)?) => { ... };
}
Expand description

Matches a JSON array whose elements pair one-to-one with the provided matchers, ignoring order.

The array length must equal the matcher count.

§Examples

assert_that!(
    j!(["a", "b", j!("c")]),
    json::unordered_elements_are!["a", j!("c"), starts_with("b")]
);
assert_that!(
    j!(["a", "x", "c"]),
    json::unordered_elements_are![eq("c"), eq("a"), eq("b")]
);

§Supported Inputs

  • Literal JSON-compatible values
  • Direct serde_json::Value
  • Native googletest matchers