mirror of
https://github.com/zed-industries/zed.git
synced 2025-02-08 19:43:11 +00:00
Update all MultiBuffer unit tests, removing expected trailing newline
This commit is contained in:
parent
f4115ddc3c
commit
f8ef605cbd
2 changed files with 26 additions and 26 deletions
|
@ -5902,7 +5902,7 @@ mod tests {
|
|||
multibuffer
|
||||
});
|
||||
|
||||
assert_eq!(multibuffer.read(cx).read(cx).text(), "aaaa\nbbbb\n");
|
||||
assert_eq!(multibuffer.read(cx).read(cx).text(), "aaaa\nbbbb");
|
||||
|
||||
let (_, view) = cx.add_window(Default::default(), |cx| {
|
||||
build_editor(multibuffer, settings, cx)
|
||||
|
@ -5918,7 +5918,7 @@ mod tests {
|
|||
.unwrap();
|
||||
|
||||
view.handle_input(&Input("X".to_string()), cx);
|
||||
assert_eq!(view.text(cx), "Xaaaa\nXbbbb\n");
|
||||
assert_eq!(view.text(cx), "Xaaaa\nXbbbb");
|
||||
assert_eq!(
|
||||
view.selected_display_ranges(cx),
|
||||
&[
|
||||
|
@ -5958,7 +5958,7 @@ mod tests {
|
|||
|
||||
assert_eq!(
|
||||
multibuffer.read(cx).read(cx).text(),
|
||||
"aaaa\nbbbb\nbbbb\ncccc\n"
|
||||
"aaaa\nbbbb\nbbbb\ncccc"
|
||||
);
|
||||
|
||||
let (_, view) = cx.add_window(Default::default(), |cx| {
|
||||
|
@ -5975,7 +5975,7 @@ mod tests {
|
|||
.unwrap();
|
||||
|
||||
view.handle_input(&Input("X".to_string()), cx);
|
||||
assert_eq!(view.text(cx), "aaaa\nbXbbXb\nbXbbXb\ncccc\n");
|
||||
assert_eq!(view.text(cx), "aaaa\nbXbbXb\nbXbbXb\ncccc");
|
||||
assert_eq!(
|
||||
view.selected_display_ranges(cx),
|
||||
&[
|
||||
|
|
|
@ -2032,7 +2032,7 @@ mod tests {
|
|||
subscription.consume().into_inner(),
|
||||
[Edit {
|
||||
old: 0..0,
|
||||
new: 0..13
|
||||
new: 0..12
|
||||
}]
|
||||
);
|
||||
|
||||
|
@ -2057,8 +2057,8 @@ mod tests {
|
|||
assert_eq!(
|
||||
subscription.consume().into_inner(),
|
||||
[Edit {
|
||||
old: 13..13,
|
||||
new: 13..29
|
||||
old: 12..12,
|
||||
new: 12..28
|
||||
}]
|
||||
);
|
||||
|
||||
|
@ -2078,7 +2078,7 @@ mod tests {
|
|||
"\n", //
|
||||
"\n", //
|
||||
"\n", //
|
||||
"jj\n" //
|
||||
"jj" //
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -2138,7 +2138,7 @@ mod tests {
|
|||
"\n", //
|
||||
"\n", //
|
||||
"\n", //
|
||||
"jj\n" //
|
||||
"jj" //
|
||||
)
|
||||
);
|
||||
|
||||
|
@ -2209,8 +2209,8 @@ mod tests {
|
|||
});
|
||||
let new_snapshot = multibuffer.read(cx).snapshot(cx);
|
||||
|
||||
assert_eq!(old_snapshot.text(), "\nabcd\n\nefghi\n");
|
||||
assert_eq!(new_snapshot.text(), "\nWabcdX\n\nYefghiZ\n");
|
||||
assert_eq!(old_snapshot.text(), "\nabcd\n\nefghi");
|
||||
assert_eq!(new_snapshot.text(), "\nWabcdX\n\nYefghiZ");
|
||||
|
||||
assert_eq!(old_snapshot.anchor_before(0).to_offset(&new_snapshot), 1);
|
||||
assert_eq!(old_snapshot.anchor_after(0).to_offset(&new_snapshot), 2);
|
||||
|
@ -2220,8 +2220,8 @@ mod tests {
|
|||
assert_eq!(old_snapshot.anchor_after(2).to_offset(&new_snapshot), 3);
|
||||
assert_eq!(old_snapshot.anchor_before(7).to_offset(&new_snapshot), 9);
|
||||
assert_eq!(old_snapshot.anchor_after(7).to_offset(&new_snapshot), 10);
|
||||
assert_eq!(old_snapshot.anchor_before(13).to_offset(&new_snapshot), 16);
|
||||
assert_eq!(old_snapshot.anchor_after(13).to_offset(&new_snapshot), 17);
|
||||
assert_eq!(old_snapshot.anchor_before(12).to_offset(&new_snapshot), 15);
|
||||
assert_eq!(old_snapshot.anchor_after(12).to_offset(&new_snapshot), 16);
|
||||
}
|
||||
|
||||
#[gpui::test(iterations = 100)]
|
||||
|
@ -2559,46 +2559,46 @@ mod tests {
|
|||
cx,
|
||||
);
|
||||
multibuffer.end_transaction_at(now, cx);
|
||||
assert_eq!(multibuffer.read(cx).text(), "AB1234\nAB5678\n");
|
||||
assert_eq!(multibuffer.read(cx).text(), "AB1234\nAB5678");
|
||||
|
||||
now += 2 * group_interval;
|
||||
multibuffer.start_transaction_at(now, cx);
|
||||
multibuffer.edit([2..2], "C", cx);
|
||||
multibuffer.end_transaction_at(now, cx);
|
||||
assert_eq!(multibuffer.read(cx).text(), "ABC1234\nAB5678\n");
|
||||
assert_eq!(multibuffer.read(cx).text(), "ABC1234\nAB5678");
|
||||
|
||||
multibuffer.undo(cx);
|
||||
assert_eq!(multibuffer.read(cx).text(), "AB1234\nAB5678\n");
|
||||
assert_eq!(multibuffer.read(cx).text(), "AB1234\nAB5678");
|
||||
|
||||
multibuffer.undo(cx);
|
||||
assert_eq!(multibuffer.read(cx).text(), "1234\n5678\n");
|
||||
assert_eq!(multibuffer.read(cx).text(), "1234\n5678");
|
||||
|
||||
multibuffer.redo(cx);
|
||||
assert_eq!(multibuffer.read(cx).text(), "AB1234\nAB5678\n");
|
||||
assert_eq!(multibuffer.read(cx).text(), "AB1234\nAB5678");
|
||||
|
||||
multibuffer.redo(cx);
|
||||
assert_eq!(multibuffer.read(cx).text(), "ABC1234\nAB5678\n");
|
||||
assert_eq!(multibuffer.read(cx).text(), "ABC1234\nAB5678");
|
||||
|
||||
buffer_1.update(cx, |buffer_1, cx| buffer_1.undo(cx));
|
||||
assert_eq!(multibuffer.read(cx).text(), "AB1234\nAB5678\n");
|
||||
assert_eq!(multibuffer.read(cx).text(), "AB1234\nAB5678");
|
||||
|
||||
multibuffer.undo(cx);
|
||||
assert_eq!(multibuffer.read(cx).text(), "1234\n5678\n");
|
||||
assert_eq!(multibuffer.read(cx).text(), "1234\n5678");
|
||||
|
||||
multibuffer.redo(cx);
|
||||
assert_eq!(multibuffer.read(cx).text(), "AB1234\nAB5678\n");
|
||||
assert_eq!(multibuffer.read(cx).text(), "AB1234\nAB5678");
|
||||
|
||||
multibuffer.redo(cx);
|
||||
assert_eq!(multibuffer.read(cx).text(), "ABC1234\nAB5678\n");
|
||||
assert_eq!(multibuffer.read(cx).text(), "ABC1234\nAB5678");
|
||||
|
||||
multibuffer.undo(cx);
|
||||
assert_eq!(multibuffer.read(cx).text(), "AB1234\nAB5678\n");
|
||||
assert_eq!(multibuffer.read(cx).text(), "AB1234\nAB5678");
|
||||
|
||||
buffer_1.update(cx, |buffer_1, cx| buffer_1.redo(cx));
|
||||
assert_eq!(multibuffer.read(cx).text(), "ABC1234\nAB5678\n");
|
||||
assert_eq!(multibuffer.read(cx).text(), "ABC1234\nAB5678");
|
||||
|
||||
multibuffer.undo(cx);
|
||||
assert_eq!(multibuffer.read(cx).text(), "C1234\n5678\n");
|
||||
assert_eq!(multibuffer.read(cx).text(), "C1234\n5678");
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue