Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.
In editor following test, apply excerpt removals to both followers
Max Brunsfeld09d3fbf04fb7
diff --git a/crates/editor/src/editor_tests.rs b/crates/editor/src/editor_tests.rsindex 510a94c2f17..74fcd27fc36 100644--- a/crates/editor/src/editor_tests.rs+++ b/crates/editor/src/editor_tests.rs@@ -5129,9 +5129,9 @@ async fn test_following_with_multiple_excerpts(cx: &mut gpui::TestAppContext) {.await.unwrap();- let follower_1_update = Rc::new(RefCell::new(None));+ let update_message = Rc::new(RefCell::new(None));follower_1.update(cx, {- let update = follower_1_update.clone();+ let update = update_message.clone();|_, cx| {cx.subscribe(&leader, move |_, leader, event, cx| {leader@@ -5192,33 +5192,30 @@ async fn test_following_with_multiple_excerpts(cx: &mut gpui::TestAppContext) {});});- // Start following separately after it already has excerpts.- let mut state_message = leader.update(cx, |leader, cx| leader.to_state_proto(cx));- let follower_2 = cx- .update(|cx| {- Editor::from_state_proto(pane.clone(), project.clone(), &mut state_message, cx)+ // Apply the update of adding the excerpts.+ follower_1+ .update(cx, |follower, cx| {+ follower.apply_update_proto(&project, update_message.borrow().clone().unwrap(), cx)})- .unwrap().await.unwrap();assert_eq!(- follower_2.read_with(cx, Editor::text),+ follower_1.read_with(cx, Editor::text),leader.read_with(cx, Editor::text));+ update_message.borrow_mut().take();- // Apply the update of adding the excerpts.- follower_1- .update(cx, |follower, cx| {- follower.apply_update_proto(- &project,- follower_1_update.borrow_mut().take().unwrap(),- cx,- )+ // Start following separately after it already has excerpts.+ let mut state_message = leader.update(cx, |leader, cx| leader.to_state_proto(cx));+ let follower_2 = cx+ .update(|cx| {+ Editor::from_state_proto(pane.clone(), project.clone(), &mut state_message, cx)})+ .unwrap().await.unwrap();assert_eq!(- follower_1.read_with(cx, Editor::text),+ follower_2.read_with(cx, Editor::text),leader.read_with(cx, Editor::text));@@ -5234,14 +5231,17 @@ async fn test_following_with_multiple_excerpts(cx: &mut gpui::TestAppContext) {// Apply the update of removing the excerpts.follower_1.update(cx, |follower, cx| {- follower.apply_update_proto(- &project,- follower_1_update.borrow_mut().take().unwrap(),- cx,- )+ follower.apply_update_proto(&project, update_message.borrow().clone().unwrap(), cx)+ })+ .await+ .unwrap();+ follower_2+ .update(cx, |follower, cx| {+ follower.apply_update_proto(&project, update_message.borrow().clone().unwrap(), cx)}).await.unwrap();+ update_message.borrow_mut().take();assert_eq!(follower_1.read_with(cx, Editor::text),leader.read_with(cx, Editor::text)