Macro pact_consumer::each_like[][src]

macro_rules! each_like {
    ($($token:tt)+) => { ... };
}
Expand description

Generates the specified value, matches any value of the same data type. This is intended for use inside json_pattern!, and it interprets its arguments as a json_pattern!.

use pact_consumer::*;

json_pattern!({
  // Expect an array of strings.
  "tags": each_like!("tag"),

  // Expect an array of objects, each of which has a name key containing
  // a string (but match the actual names by type). Require a minimum of
  // two elements.
  "people": each_like!({
    "name": "J. Smith",
  }, min=2),
});