difference

Macro assert_diff

Source
macro_rules! assert_diff {
    ($orig:expr , $edit:expr, $split: expr, $expected: expr) => { ... };
}
Expand description

Assert the difference between two strings. Works like diff, but takes a fourth parameter that is the expected edit distance (e.g. 0 if you want to test for equality).

To include this macro use:

#[macro_use(assert_diff)]
extern crate difference;

Remember that edit distance might not be equal to your understanding of difference, for example the words “Rust” and “Dust” have an edit distance of 2 because two changes (a removal and an addition) are required to make them look the same.

Will print an error with a colorful diff in case of failure.