Skip to main content

Crate utmt

Crate utmt 

Source
Expand description

This crate offers a list of macros for unittest support. The aim of these macros is to extends existing rust unittest macros by adding some new assertions and facilities.

Macrosยง

assert_all
Multi-assertion macro. This macro take at least 1 argument as an expression. Several expressions can be added.
assert_match_option
Assert the Option<T> value. If the value is Some(...) return Ok(()), otherwise a Err value.
assert_match_result
Assert for a Result<T, E> value. If the value is a type of Ok(_) the result is Ok(()). If the value is a type of Err(_) the result is a type of Err(&str).
assert_match_values
Assertion for matching specific values.
assert_not_match_option
Assert the Option<T> for a result that does not match the given argument. If the value is None return Ok(()) result. If the value is Some(...) return None result.
assert_not_match_result
Assert for a not validResult<T, E> value. If the value is a type of Err(_) the result is Ok(()). If the value is a type of Ok(_) the result is a type of Err(&str).
assert_not_match_values
Assert on invalid values.
assert_not_same_slices
Assertion for not same slices. Not same slices means, is not same content or not same the size.
assert_same_slices
Assertion for same slices. Same slices means, the order is not guaranteed, but the size and the content are equals.
assert_slices_eq
Assertion about slices equality.
assert_slices_ne
Assertion about slices inequality.
facility_match_values
Match the specific values.
fail
Force the test failure.
repeat
Repeat the code block for a number of iterations.
setup
Setup for unit test initialization.
teardown
Teardown for unit tests. The code of the teardown macro will be running automatically while the test will end, with test failure or not.