Skip to content

Releases: google/assertor

v0.0.3

24 Sep 18:21
34f63f5
Compare
Choose a tag to compare

New additions

  • New method some for Option assertion:
assert_that!(Some("foobar")).some().starts_with("foo");
  • New methods ok and err for Result assertion:
assert_that!(Ok::<&str, ()>("ok_value"))
    .ok()
    .starts_with("ok");
assert_that!(Err::<(), &str>("err msg"))
    .err()
    .starts_with("err");
  • New assertion for anyhow result type:
assert_that!(anyhow!("error message")).has_message("error message");
  • New assertion for Cow:
assert_that!(Cow::Borrowed("foobar")).deref().starts_with("foo");
  • New multiple methods for map assertion
  • Support of BTreeMap
let tree_map = BTreeMap::from([("hello", "sorted_map"), ("world", "in")]);
assert_that!(tree_map)
    .contains_exactly_in_order(BTreeMap::from([("hello", "sorted_map"), ("world", "in")]));
  • Multiple methods for set assertion
  • Support for BTreeSet
assert_that!(BTreeSet::from([1, 2, 3])).contains_all_of_in_order(BTreeSet::from([1, 2, 3]));
  • New is_not_empty method for iterator assertion
assert_that!(vec![1]).is_not_empty();

Note: Initial release using GitHub release.