Expand description
see https://github.com/aaronabramov/k9 for high level description of the library
Modules§
Macros§
- assert_
equal - Asserts that two passed arguments are equal. Panics if they’re not, using a pretty printed difference of Debug representations of the passed arguments.
- assert_
err - Asserts if value is Err(E). panics if it is not
- assert_
err_ matches_ regex - Asserts that the passed
Result
argument is anErr
and and the debug string of that error matches provided regex. Regular expressions are compiled usingregex
crate. - assert_
greater_ than - Asserts if left is greater than right. panics if they are not
- assert_
greater_ than_ or_ equal - Asserts if left greater than or equal to right. panics if they are not
- assert_
lesser_ than - Asserts if left is lesser than right. panics if they are not
- assert_
lesser_ than_ or_ equal - Asserts if left lesser than or equal to right. panics if they are not
- assert_
matches_ regex - Asserts that passed
&str
matches a regular expression. Regular expressions are compiled usingregex
crate. - assert_
matches_ snapshot - Same as snapshot!() macro, but it takes a string as the only argument and stores the snapshot in a separate file instead of inlining it in the source code of the test.
- assert_
ok - Asserts if value is Ok(T). panics if it is not
- make_
assertion - snapshot
- Serializes the first argument into a string and compares it with the second argument, which is a snapshot string that was automatically generated during previous test runs. Panics if the values are not equal.
Structs§
- Multiline
String - assert_equal! takes a std::fmt::Debug trait object as an argument
which doesn’t work well with multiline strings, since newline characters will be displayed as
\n
For example this string: - Snap
- String with concurrent access. Allows mutation without &mut reference to itself. It makes passing it to different parts of tests easier when performance is not important. Useful for accumulating output from a system under test and later using it with assert_matches_inline_snapshot.