1 assert(diff("abc", "abc") == tuple("abc", "abc")); 2 // highlight difference 3 assert(diff("abc", "Abc") == tuple("<a>bc", "<A>bc")); 4 assert(diff("abc", "aBc") == tuple("a<b>c", "a<B>c")); 5 assert(diff("abc", "abC") == tuple("ab<c>", "ab<C>")); 6 assert(diff("abc", "") == tuple("<abc>", "<>")); 7 assert(diff("abc", "abbc") == tuple("ab<>c", "ab<b>c")); 8 // abbreviate long prefix or suffix 9 assert(diff("_12345678901234567890a", "_12345678901234567890A") 10 == tuple("...12345678901234567890<a>", "...12345678901234567890<A>")); 11 assert(diff("a12345678901234567890_", "A12345678901234567890_") 12 == tuple("<a>12345678901234567890...", "<A>12345678901234567890..."));
Returns a pair of strings that highlight the difference between lhs and rhs.