Open elinorbgr opened 6 years ago
Same problem. I have strings count: 0
and count: 0\n
, receiving distance = 1
and:
[
Same(
"count: 0\n",
),
]
UPD: solved it by following hack:
let (distance, diffs) = diff(expected, actual, "\n");
let (distance, diffs) = if distance != 0 && diffs.len() == 1 {
diff(expected, actual, "")
} else {
(distance, diffs)
};
And then added hack for formatting diffs, which checks for strings equal to "\n"
, which can happen only in this case and not printing them, so output will be:
count: 0
+
Consider this example:
It outputs this:
There is an inconsistency here, there is a distance of 4 yet the diff is only a single
Same
entry.I would typically have expected the diff to be something like: