mirror of
https://github.com/zed-industries/zed.git
synced 2024-11-08 07:35:01 +03:00
Add unit test showing problem with serialization of undo ops
This commit is contained in:
parent
5d45c5711d
commit
d7ecbdcc1d
@ -780,6 +780,21 @@ async fn test_empty_diagnostic_ranges(mut cx: gpui::TestAppContext) {
|
||||
});
|
||||
}
|
||||
|
||||
#[gpui::test]
|
||||
fn test_serialization(cx: &mut gpui::MutableAppContext) {
|
||||
let buffer1 = cx.add_model(|cx| {
|
||||
let mut buffer = Buffer::new(0, "abc", cx);
|
||||
buffer.edit([3..3], "DE", cx);
|
||||
buffer.undo(cx);
|
||||
buffer
|
||||
});
|
||||
assert_eq!(buffer1.read(cx).text(), "abc");
|
||||
|
||||
let message = buffer1.read(cx).to_proto();
|
||||
let buffer2 = cx.add_model(|cx| Buffer::from_proto(1, message, None, cx).unwrap());
|
||||
assert_eq!(buffer2.read(cx).text(), "abc");
|
||||
}
|
||||
|
||||
fn chunks_with_diagnostics<T: ToOffset + ToPoint>(
|
||||
buffer: &Buffer,
|
||||
range: Range<T>,
|
||||
|
Loading…
Reference in New Issue
Block a user