Module assertions

Source
Expand description

Definitions of the assertions that are provided by this crate.

Assertions define the methods that are used to assert that the actual test result is as expected. Assertions are defined by traits that are implemented for one or several types. An assertion can be applied to all types that implement this assertion.

All assertions provided by this crate are defined in this module. Browse over the traits in this module to get information about all provided assertions.

Traitsยง

AssertBoolean
Assert whether some value or expression is true or false.
AssertBorrowedOptionValue
Assert the value of a borrowed option by mapping the subject.
AssertBorrowedResultValue
Assert the ok-value or error of a borrowed result by mapping the subject.
AssertChar
Assert properties or classifications of a character.
AssertCodePanicspanic
Assert that the code under test panics, panics with a certain message or does not panic.
AssertDecimalNumber
Assert decimal number specific properties.
AssertEmptiness
Assert whether a string, collection or iterator is empty or not.
AssertEquality
Assert whether two values are equal or not.
AssertErrorHasSource
Assert the source of any type that implements std::error::Error.
AssertHasCharCount
Assert the number of characters contained in a string or similar container.
AssertHasDebugMessage
Assert a type formatted into a debug string.
AssertHasDisplayMessage
Assert a type formatted into a display string.
AssertHasError
Assert that a subject of some container type holds an error value that is equal to the expected one.
AssertHasErrorMessage
Assert that a subject of some container type holds an error value that has a message equal to the expected message.
AssertHasLength
Assert the length of a subject.
AssertHasValue
Assert that a subject of some container type holds a value that is equal to the expected one.
AssertInRange
Assert whether a value is within an expected range.
AssertInfinity
Assert whether a numeric value is infinite or finite.
AssertIsCloseToWithDefaultMarginfloat-cmp
Assert approximate equality for floating point numbers.
AssertIsCloseToWithinMarginfloat-cmp
Assert approximate equality for floating point numbers.
AssertIsSorted
Assert the order of the values within a collection.
AssertIteratorContains
Assert that an iterator or collection contains the expected value.
AssertIteratorContainsInAnyOrder
Assert values in a collection.
AssertIteratorContainsInOrder
Assert values in an ordered collection.
AssertMapContainsKey
Assertions for the keys of a map.
AssertMapContainsValue
Assertions for the values of a map.
AssertNotANumber
Assert whether a numeric value is not a number.
AssertNumericIdentity
Assert the additive and multiplicative identity of a number.
AssertOption
Assert whether a subject of the Option type holds some value or has none.
AssertOptionValue
Assert the value of an option by mapping the subject.
AssertOrder
Assert whether a value is greater than or less than another value, as well as at most as big or at least as big as another value.
AssertResult
Assert whether a subject of the Result type holds some value or an error.
AssertResultValue
Assert the ok-value or error of a result by mapping the subject.
AssertSignum
Assert whether a numeric value is negative or positive.
AssertStringContainsAnyOf
Assert that a string contains any char from a collection of chars.
AssertStringMatchesregex
Assert that a string matches a regex pattern.
AssertStringPattern
Assert that a string contains a substring or character.