Skip to content

0.4.0

Pre-release
Pre-release
Compare
Choose a tag to compare
@bjacotg bjacotg released this 10 Mar 16:37
· 585 commits to main since this release

New additions

  • The new matcher StrMatcher combines string equality (using eq with String or &str), starts_with, ends_with, and contains_substring and provides common features for all of these. This includes ASCII case-insensitive matching and ignoring leading and trailing whitespace.
  • The new matcher predicate allows matching using an arbitrary predicate on the input.

Other improvements

  • There is now crate-level documentation, including a table of available matchers.
  • The documentation for the declarative macros which generate matchers (all!, matchers_pattern!, unordered_elements_are! and so on) has been improved to more clearly indicate what the arguments should be as well as the types of values against which they match.
  • elements_are!, unordered_elements_are!, pointwise!, and size no longer require the actual value to implement HasSize.
  • Match failure and expectation descriptions are now properly indented.

API changes

  • The minimum supported Rust version is now 1.67.0.

  • The trait HasSize has been removed. The matchers which depended on it now just require the actual value to support IntoIterator.

    If you implemented HasSize for one of your collections, just remove the impl HasSize since it is not needed.

  • The matcher eq_ignoring_ascii_case has been removed. Use eq("...").ignoring_ascii_case() instead:

    OLD:

    verify_that!("ABC", eq_ignoring_ascii_case("abc"))
    

    NEW:

    verify_that!("ABC", eq("abc").ignoring_ascii_case())
    
  • One should no longer take a reference to a slice when using the size macher:

    OLD:

    let value = &[1, 2, 3];
    verify_that(&value[0..1], size(eq(1)))?;
    

    NEW:

    let value = &[1, 2, 3];
    verify_that(value[0..1], size(eq(1)))?;