You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
"failed to call custom diff command `{diff_command}`: {err}"
2660
+
));
2661
+
}
2662
+
Ok(output) => {
2663
+
let output = String::from_utf8_lossy(&output.stdout);
2664
+
eprint!("{output}");
2665
+
}
2666
+
}
2667
+
}else{
2668
+
eprint!("{}", write_diff(expected, actual,3));
2669
+
}
2670
+
2671
+
// NOTE: argument order is important, we need `actual` to be on the left so the line number match up when we compare it to `actual_unnormalized` below.
// NOTE: `Expected` is actually correct here, the argument order is reversed so our line numbers match up
2679
+
ifletDiffLine::Expected(normalized) = line {
2680
+
mismatches_normalized += &normalized;
2681
+
mismatches_normalized += "\n";
2682
+
mismatch_line_nos.push(line_no);
2683
+
line_no += 1;
2684
+
}
2685
+
}
2686
+
}
2687
+
letmut mismatches_unnormalized = String::new();
2688
+
let diff_normalized = make_diff(actual, actual_unnormalized,0);
2689
+
for hunk in diff_normalized {
2690
+
if mismatch_line_nos.contains(&hunk.line_number){
2691
+
for line in hunk.lines{
2692
+
ifletDiffLine::Resulting(unnormalized) = line {
2693
+
mismatches_unnormalized += &unnormalized;
2694
+
mismatches_unnormalized += "\n";
2695
+
}
2696
+
}
2697
+
}
2698
+
}
2699
+
2700
+
let normalized_diff = make_diff(&mismatches_normalized,&mismatches_unnormalized,0);
2701
+
// HACK: instead of checking if each hunk is empty, this only checks if the whole input is empty. we should be smarter about this so we don't treat added or removed output as normalized.
2702
+
if !normalized_diff.is_empty()
2703
+
&& !mismatches_unnormalized.is_empty()
2704
+
&& !mismatches_normalized.is_empty()
2705
+
{
2706
+
eprintln!("Note: some mismatched output was normalized before being compared");
0 commit comments