Test longest row only when tabs are not present or the tab size is 1

This is because the longest row calculation is best-effort at the moment,
since this information is not indexed in the `TabMap`.
This commit is contained in:
Antonio Scandurra 2021-11-18 10:41:47 +01:00
parent 5a9dea5299
commit 572e571927
2 changed files with 34 additions and 26 deletions

View file

@ -506,14 +506,14 @@ mod tests {
.map(|c| c.text)
.collect::<String>()
);
assert_eq!(
TextSummary {
longest_row: expected_summary.longest_row,
longest_row_chars: expected_summary.longest_row_chars,
..tabs_snapshot.text_summary_for_range(start..end)
},
expected_summary,
);
let mut actual_summary = tabs_snapshot.text_summary_for_range(start..end);
if tab_size > 1 && folds_snapshot.text().contains('\t') {
actual_summary.longest_row = expected_summary.longest_row;
actual_summary.longest_row_chars = expected_summary.longest_row_chars;
}
assert_eq!(actual_summary, expected_summary,);
}
}
}