Skip to content

0.6.0

Compare
Choose a tag to compare
@audunhalland audunhalland released this 25 Mar 00:31
· 23 commits to main since this release

Changed

  • Unimock now supports very flexible argument mutation, instead of one hard-coded parameter.
    To achieve this, the answers API had to be redesigned with a new signature based on a dyn Fn.
    This dynamic function type has one fixed signature per MockFn, so its return type isn't generic as it used to be in 0.5.x.
    All generated borrows have to be done explicitly through Unimock::make_ref for this to work. (#43, #47)
    • The function passed to answers must be a &static Fn, or it can be an Arc closure that can be registered by calling answers_arc.
    • The parameters passed to this function are the same as passed to the mocked trait method, including self.
  • Output trait hierarchy (which allows safely mocking borrowed return values) rewritten to be more flexible and future-proof than previously (#46)
  • default_implementation renamed to applies_default_impl.
  • unmocked renamed to applies_unmocked.

Added

  • Mocks for tokio-1 and futures-io-0-3 async read/write traits (#45)

Fixed

  • Fix matching! against references to number literals (#42)
  • Borrows from function arguments can now be made without leaking memory (#47)

Removed

  • The mutates builder APIs. These are now handled using answers.