Crate galvanic_assert

Source
Expand description

§Galvanic-assert: Matcher-based assertions for easier testing

This crate provides a new assertion macros (assert_that!, expect_that!, get_expectation_for!) based on matching predicates (matchers) to

  • make writing asserts easier
  • make reading asserts comprehendable
  • easily extend the assertion framework
  • provide a large list common matchers
  • integrate with galvanic-test and galvanic-mock (both still in development … stay tuned!)
  • be used with your favourite test framework

The crate will be part of galvanic—a complete test framework for Rust.

Modules§

Macros§

  • Takes a list of matchers for the same type combines them conjunctively.
  • Takes a list of matchers for the same type combines them disjunctively.
  • States that the asserted value satisfies the required properties of the supplied Matcher.
  • States that the asserted values satisfies the required properties of the supplied Matcher but waits until the end of the block to inspect the results.
  • States that the asserted values satisfies the required properties of the supplied Matcher and returns an Expectation object to inspect the results at a later time.
  • Write patterns of structs/enums which use Matchers instead of field values.
  • Matches if the asserted value’s variant matches the expected variant.
  • Shorter name for has_structure!.

Structs§

Enums§

Traits§

  • The trait which has to be implemented by all matchers.