I'm having a lot of tests where the expected value is multi-line text in a &'static str
. When a test fails, I find it hard to read the actual problem, as what I get is the left and right debug-escaped very long strings. I would like to get something more similar to command-line diff left right
(if the strings were files).
I found pretty_assertions which is kind of similar but for structured data rather than text. If i do:
pretty_assertions::assert_eq!(
result.lines().collect::<Vec<_>>(),
expected.lines().collect::<Vec<_>>(),
);
but I would prefer
- To have the lines split/collected automatically (and only on failure)
- I would like to not get color-coded output (at least when running the tests in an emacs buffer, which doesn't handle that).
Is there any assert utility that might suite me better?