0.4.0
Pre-release
Pre-release
New additions
- The new matcher
StrMatcher
combines string equality (usingeq
withString
or&str
),starts_with
,ends_with
, andcontains_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!
, andsize
no 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
HasSize
has been removed. The matchers which depended on it now just require the actual value to supportIntoIterator
.If you implemented
HasSize
for one of your collections, just remove theimpl HasSize
since it is not needed. -
The matcher
eq_ignoring_ascii_case
has 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
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)))?;