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_
all_ match_ result - Multi-assertion macro for method that return a
Resultvalue. Seval expressions of this type must be specified. - assert_
match_ natural_ result - Assert for a
Result<T, E>value. If the value is a type ofOk(_)the result isOk(()). If the value is a type ofErr(_)the result is the natural error from the method calling. - assert_
match_ option - Assert the
Option<T>value. If the value isSome(...)returnOk(()), otherwise aErrvalue. - assert_
match_ result - Assert for a
Result<T, E>value. If the value is a type ofOk(_)the result isOk(()). If the value is a type ofErr(_)the result is a type ofErr(&str). - assert_
match_ values - Assertion for matching specific values.
- assert_
none - Assertion for a non value. If this option is none, the assertion is valid.
- assert_
not_ match_ option - Assert the
Option<T>for a result that does not match the given argument. If the value isNonereturnOk(())result. If the value isSome(...)returnNoneresult. - assert_
not_ match_ result - Assert for a not valid
Result<T, E>value. If the value is a type ofErr(_)the result isOk(()). If the value is a type ofOk(_)the result is a type ofErr(&str). - assert_
not_ match_ values - Assert on invalid values.
- assert_
not_ none - Assertion for an option value. If this option value is not none, the assertion is valid.
- 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.
Functions§
- mark_
fail - Shows a simple mark for a failed test
- mark_ok
- Shows a simple mark for a test ok
- mark_
run - Shows a simple mark for a test running
- random_
string - Creates a random string for the specified length.