Crate galvanic_assert [] [src]

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

matchers

Macros

all_of

Takes a list of matchers for the same type combines them conjunctively.

any_of

Takes a list of matchers for the same type combines them disjunctively.

assert_that

States that the asserted value satisfies the required properties of the supplied Matcher.

expect_that

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.

get_expectation_for

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.

is_variant

Matches if the asserted value's variant matches the expected variant.

Structs

MatchResultBuilder

A builder for creating MatchResults.

Enums

Expectation

The result of a deferred assertion.

MatchResult

The return type of any Machter

Traits

Matcher

The trait which has to be implemented by all matchers.