mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-28 21:32:39 +00:00
Get the randomized soft wrap test passing with no edits
Co-Authored-By: Max Brunsfeld <maxbrunsfeld@gmail.com>
This commit is contained in:
parent
2ce42ff6b6
commit
e0da3fd714
1 changed files with 17 additions and 2 deletions
|
@ -531,16 +531,31 @@ mod tests {
|
|||
wrapper.sync(tabs_snapshot.clone(), vec![edit]);
|
||||
|
||||
let mut expected_text = String::new();
|
||||
for line in tabs_snapshot.text().lines() {
|
||||
let unwrapped_text = tabs_snapshot.text();
|
||||
let mut unwrapped_lines = unwrapped_text.split('\n').peekable();
|
||||
while let Some(line) = unwrapped_lines.next() {
|
||||
let mut prev_ix = 0;
|
||||
for ix in font_system.wrap_line(line, font_id, 14.0, config.wrap_width) {
|
||||
expected_text.push_str(&line[prev_ix..ix]);
|
||||
expected_text.push('\n');
|
||||
prev_ix = ix;
|
||||
}
|
||||
expected_text.push_str(&line[prev_ix..]);
|
||||
if unwrapped_lines.peek().is_some() {
|
||||
expected_text.push('\n');
|
||||
}
|
||||
}
|
||||
|
||||
dbg!(expected_text);
|
||||
let actual_text = wrapper
|
||||
.snapshot
|
||||
.chunks_at(OutputPoint::zero())
|
||||
.collect::<String>();
|
||||
|
||||
assert_eq!(
|
||||
actual_text, expected_text,
|
||||
"unwrapped text is: {:?}",
|
||||
unwrapped_text
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue