Function termstyle::eprint_diff
[−]
[src]
pub fn eprint_diff(expected: &[u8], result: &[u8]) -> (String, String)
Helper function to make tests easier for others.
If a diff exists, render the full form of both and their "repr" version to stderr, then return their human readable and copy-pastable renderings.
This is useful for testing, as you can clearly see the differences.
It is recommended to then assert_eq
on the response using the excelent pretty_assertiosn
crate to help you diagnose any issues.
Examples
let result = vec![55, 60, 73, 7, 145, 80]; let expected = vec![55, 60, 73, 7, 145, 80]; let (repr_result, repr_expected) = termstyle::eprint_diff(&expected, &result); assert_eq!(repr_result, repr_expected);