0.4.0
Pre-release
Pre-release
New additions
- The new matcher
StrMatchercombines string equality (usingeqwithStringor&str),starts_with,ends_with, andcontains_substringand provides common features for all of these. This includes ASCII case-insensitive matching and ignoring leading and trailing whitespace. - The new matcher
predicateallows 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!, andsizeno longer require the actual value to implementHasSize.- Match failure and expectation descriptions are now properly indented.
API changes
-
The minimum supported Rust version is now 1.67.0.
-
The trait
HasSizehas been removed. The matchers which depended on it now just require the actual value to supportIntoIterator.If you implemented
HasSizefor one of your collections, just remove theimpl HasSizesince it is not needed. -
The matcher
eq_ignoring_ascii_casehas been removed. Useeq("...").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
sizemacher: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)))?;