This commit is contained in:
Mikayla 2023-11-08 21:32:59 -08:00
parent 8330fb5f10
commit 0bfd18ba09
No known key found for this signature in database
5 changed files with 9635 additions and 9641 deletions

View file

@ -4,6 +4,7 @@ use gpui::{Model, TestAppContext};
mod channel_buffer_tests; mod channel_buffer_tests;
mod channel_message_tests; mod channel_message_tests;
mod channel_tests; mod channel_tests;
mod editor_tests;
mod following_tests; mod following_tests;
mod integration_tests; mod integration_tests;
mod notification_tests; mod notification_tests;

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -1,81 +1,72 @@
pub mod editor_lsp_test_context; pub mod editor_lsp_test_context;
pub mod editor_test_context; pub mod editor_test_context;
// todo!() use crate::{
// use crate::{ display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint},
// display_map::{DisplayMap, DisplaySnapshot, ToDisplayPoint}, DisplayPoint, Editor, EditorMode, MultiBuffer,
// DisplayPoint, Editor, EditorMode, MultiBuffer, };
// };
// use gpui::{Model, ViewContext}; use gpui::{Context, Model, Pixels, ViewContext};
// use project::Project; use project::Project;
// use util::test::{marked_text_offsets, marked_text_ranges}; use util::test::{marked_text_offsets, marked_text_ranges};
// #[cfg(test)] #[cfg(test)]
// #[ctor::ctor] #[ctor::ctor]
// fn init_logger() { fn init_logger() {
// if std::env::var("RUST_LOG").is_ok() { if std::env::var("RUST_LOG").is_ok() {
// env_logger::init(); env_logger::init();
// } }
// } }
// // Returns a snapshot from text containing '|' character markers with the markers removed, and DisplayPoints for each one. // Returns a snapshot from text containing '|' character markers with the markers removed, and DisplayPoints for each one.
// pub fn marked_display_snapshot( pub fn marked_display_snapshot(
// text: &str, text: &str,
// cx: &mut gpui::AppContext, cx: &mut gpui::AppContext,
// ) -> (DisplaySnapshot, Vec<DisplayPoint>) { ) -> (DisplaySnapshot, Vec<DisplayPoint>) {
// let (unmarked_text, markers) = marked_text_offsets(text); let (unmarked_text, markers) = marked_text_offsets(text);
// let family_id = cx let font = cx.text_style().font();
// .font_cache() let font_size: Pixels = 14.into();
// .load_family(&["Helvetica"], &Default::default())
// .unwrap();
// let font_id = cx
// .font_cache()
// .select_font(family_id, &Default::default())
// .unwrap();
// let font_size = 14.0;
// let buffer = MultiBuffer::build_simple(&unmarked_text, cx); let buffer = MultiBuffer::build_simple(&unmarked_text, cx);
// let display_map = let display_map = cx.build_model(|cx| DisplayMap::new(buffer, font, font_size, None, 1, 1, cx));
// cx.add_model(|cx| DisplayMap::new(buffer, font_id, font_size, None, 1, 1, cx)); let snapshot = display_map.update(cx, |map, cx| map.snapshot(cx));
// let snapshot = display_map.update(cx, |map, cx| map.snapshot(cx)); let markers = markers
// let markers = markers .into_iter()
// .into_iter() .map(|offset| offset.to_display_point(&snapshot))
// .map(|offset| offset.to_display_point(&snapshot)) .collect();
// .collect();
// (snapshot, markers) (snapshot, markers)
// } }
// pub fn select_ranges(editor: &mut Editor, marked_text: &str, cx: &mut ViewContext<Editor>) { pub fn select_ranges(editor: &mut Editor, marked_text: &str, cx: &mut ViewContext<Editor>) {
// let (unmarked_text, text_ranges) = marked_text_ranges(marked_text, true); let (unmarked_text, text_ranges) = marked_text_ranges(marked_text, true);
// assert_eq!(editor.text(cx), unmarked_text); assert_eq!(editor.text(cx), unmarked_text);
// editor.change_selections(None, cx, |s| s.select_ranges(text_ranges)); editor.change_selections(None, cx, |s| s.select_ranges(text_ranges));
// } }
// pub fn assert_text_with_selections( pub fn assert_text_with_selections(
// editor: &mut Editor, editor: &mut Editor,
// marked_text: &str, marked_text: &str,
// cx: &mut ViewContext<Editor>, cx: &mut ViewContext<Editor>,
// ) { ) {
// let (unmarked_text, text_ranges) = marked_text_ranges(marked_text, true); let (unmarked_text, text_ranges) = marked_text_ranges(marked_text, true);
// assert_eq!(editor.text(cx), unmarked_text); assert_eq!(editor.text(cx), unmarked_text);
// assert_eq!(editor.selections.ranges(cx), text_ranges); assert_eq!(editor.selections.ranges(cx), text_ranges);
// } }
// // RA thinks this is dead code even though it is used in a whole lot of tests // RA thinks this is dead code even though it is used in a whole lot of tests
// #[allow(dead_code)] #[allow(dead_code)]
// #[cfg(any(test, feature = "test-support"))] #[cfg(any(test, feature = "test-support"))]
// pub(crate) fn build_editor(buffer: Model<MultiBuffer>, cx: &mut ViewContext<Editor>) -> Editor { pub(crate) fn build_editor(buffer: Model<MultiBuffer>, cx: &mut ViewContext<Editor>) -> Editor {
// Editor::new(EditorMode::Full, buffer, None, None, cx) Editor::new(EditorMode::Full, buffer, None, None, cx)
// } }
// pub(crate) fn build_editor_with_project( pub(crate) fn build_editor_with_project(
// project: Model<Project>, project: Model<Project>,
// buffer: Model<MultiBuffer>, buffer: Model<MultiBuffer>,
// cx: &mut ViewContext<Editor>, cx: &mut ViewContext<Editor>,
// ) -> Editor { ) -> Editor {
// Editor::new(EditorMode::Full, buffer, Some(project), None, cx) Editor::new(EditorMode::Full, buffer, Some(project), None, cx)
// } }

View file

@ -19,313 +19,313 @@ use util::{
// use super::build_editor_with_project; // use super::build_editor_with_project;
// pub struct EditorTestContext<'a> { pub struct EditorTestContext<'a> {
// pub cx: &'a mut gpui::TestAppContext, pub cx: &'a mut gpui::TestAppContext,
// pub window: AnyWindowHandle, pub window: AnyWindowHandle,
// pub editor: View<Editor>, pub editor: View<Editor>,
// } }
// impl<'a> EditorTestContext<'a> { impl<'a> EditorTestContext<'a> {
// pub async fn new(cx: &'a mut gpui::TestAppContext) -> EditorTestContext<'a> { pub async fn new(cx: &'a mut gpui::TestAppContext) -> EditorTestContext<'a> {
// let fs = FakeFs::new(cx.background()); let fs = FakeFs::new(cx.executor().clone());
// // fs.insert_file("/file", "".to_owned()).await; // fs.insert_file("/file", "".to_owned()).await;
// fs.insert_tree( fs.insert_tree(
// "/root", "/root",
// gpui::serde_json::json!({ gpui::serde_json::json!({
// "file": "", "file": "",
// }), }),
// ) )
// .await; .await;
// let project = Project::test(fs, ["/root".as_ref()], cx).await; let project = Project::test(fs, ["/root".as_ref()], cx).await;
// let buffer = project let buffer = project
// .update(cx, |project, cx| { .update(cx, |project, cx| {
// project.open_local_buffer("/root/file", cx) project.open_local_buffer("/root/file", cx)
// }) })
// .await .await
// .unwrap(); .unwrap();
// let window = cx.add_window(|cx| { let window = cx.add_window(|cx| {
// cx.focus_self(); cx.focus_self();
// build_editor_with_project(project, MultiBuffer::build_from_buffer(buffer, cx), cx) build_editor_with_project(project, MultiBuffer::build_from_buffer(buffer, cx), cx)
// }); });
// let editor = window.root(cx); let editor = window.root(cx);
// Self { Self {
// cx, cx,
// window: window.into(), window: window.into(),
// editor, editor,
// } }
// } }
// pub fn condition( pub fn condition(
// &self, &self,
// predicate: impl FnMut(&Editor, &AppContext) -> bool, predicate: impl FnMut(&Editor, &AppContext) -> bool,
// ) -> impl Future<Output = ()> { ) -> impl Future<Output = ()> {
// self.editor.condition(self.cx, predicate) self.editor.condition(self.cx, predicate)
// } }
// pub fn editor<F, T>(&self, read: F) -> T pub fn editor<F, T>(&self, read: F) -> T
// where where
// F: FnOnce(&Editor, &ViewContext<Editor>) -> T, F: FnOnce(&Editor, &ViewContext<Editor>) -> T,
// { {
// self.editor.update(self.cx, read) self.editor.update(self.cx, read)
// } }
// pub fn update_editor<F, T>(&mut self, update: F) -> T pub fn update_editor<F, T>(&mut self, update: F) -> T
// where where
// F: FnOnce(&mut Editor, &mut ViewContext<Editor>) -> T, F: FnOnce(&mut Editor, &mut ViewContext<Editor>) -> T,
// { {
// self.editor.update(self.cx, update) self.editor.update(self.cx, update)
// } }
// pub fn multibuffer<F, T>(&self, read: F) -> T pub fn multibuffer<F, T>(&self, read: F) -> T
// where where
// F: FnOnce(&MultiBuffer, &AppContext) -> T, F: FnOnce(&MultiBuffer, &AppContext) -> T,
// { {
// self.editor(|editor, cx| read(editor.buffer().read(cx), cx)) self.editor(|editor, cx| read(editor.buffer().read(cx), cx))
// } }
// pub fn update_multibuffer<F, T>(&mut self, update: F) -> T pub fn update_multibuffer<F, T>(&mut self, update: F) -> T
// where where
// F: FnOnce(&mut MultiBuffer, &mut ModelContext<MultiBuffer>) -> T, F: FnOnce(&mut MultiBuffer, &mut ModelContext<MultiBuffer>) -> T,
// { {
// self.update_editor(|editor, cx| editor.buffer().update(cx, update)) self.update_editor(|editor, cx| editor.buffer().update(cx, update))
// } }
// pub fn buffer_text(&self) -> String { pub fn buffer_text(&self) -> String {
// self.multibuffer(|buffer, cx| buffer.snapshot(cx).text()) self.multibuffer(|buffer, cx| buffer.snapshot(cx).text())
// } }
// pub fn buffer<F, T>(&self, read: F) -> T pub fn buffer<F, T>(&self, read: F) -> T
// where where
// F: FnOnce(&Buffer, &AppContext) -> T, F: FnOnce(&Buffer, &AppContext) -> T,
// { {
// self.multibuffer(|multibuffer, cx| { self.multibuffer(|multibuffer, cx| {
// let buffer = multibuffer.as_singleton().unwrap().read(cx); let buffer = multibuffer.as_singleton().unwrap().read(cx);
// read(buffer, cx) read(buffer, cx)
// }) })
// } }
// pub fn update_buffer<F, T>(&mut self, update: F) -> T pub fn update_buffer<F, T>(&mut self, update: F) -> T
// where where
// F: FnOnce(&mut Buffer, &mut ModelContext<Buffer>) -> T, F: FnOnce(&mut Buffer, &mut ModelContext<Buffer>) -> T,
// { {
// self.update_multibuffer(|multibuffer, cx| { self.update_multibuffer(|multibuffer, cx| {
// let buffer = multibuffer.as_singleton().unwrap(); let buffer = multibuffer.as_singleton().unwrap();
// buffer.update(cx, update) buffer.update(cx, update)
// }) })
// } }
// pub fn buffer_snapshot(&self) -> BufferSnapshot { pub fn buffer_snapshot(&self) -> BufferSnapshot {
// self.buffer(|buffer, _| buffer.snapshot()) self.buffer(|buffer, _| buffer.snapshot())
// } }
// pub fn simulate_keystroke(&mut self, keystroke_text: &str) -> ContextHandle { pub fn simulate_keystroke(&mut self, keystroke_text: &str) -> ContextHandle {
// let keystroke_under_test_handle = let keystroke_under_test_handle =
// self.add_assertion_context(format!("Simulated Keystroke: {:?}", keystroke_text)); self.add_assertion_context(format!("Simulated Keystroke: {:?}", keystroke_text));
// let keystroke = Keystroke::parse(keystroke_text).unwrap(); let keystroke = Keystroke::parse(keystroke_text).unwrap();
// self.cx.dispatch_keystroke(self.window, keystroke, false); self.cx.dispatch_keystroke(self.window, keystroke, false);
// keystroke_under_test_handle keystroke_under_test_handle
// } }
// pub fn simulate_keystrokes<const COUNT: usize>( pub fn simulate_keystrokes<const COUNT: usize>(
// &mut self, &mut self,
// keystroke_texts: [&str; COUNT], keystroke_texts: [&str; COUNT],
// ) -> ContextHandle { ) -> ContextHandle {
// let keystrokes_under_test_handle = let keystrokes_under_test_handle =
// self.add_assertion_context(format!("Simulated Keystrokes: {:?}", keystroke_texts)); self.add_assertion_context(format!("Simulated Keystrokes: {:?}", keystroke_texts));
// for keystroke_text in keystroke_texts.into_iter() { for keystroke_text in keystroke_texts.into_iter() {
// self.simulate_keystroke(keystroke_text); self.simulate_keystroke(keystroke_text);
// } }
// // it is common for keyboard shortcuts to kick off async actions, so this ensures that they are complete // it is common for keyboard shortcuts to kick off async actions, so this ensures that they are complete
// // before returning. // before returning.
// // NOTE: we don't do this in simulate_keystroke() because a possible cause of bugs is that typing too // NOTE: we don't do this in simulate_keystroke() because a possible cause of bugs is that typing too
// // quickly races with async actions. // quickly races with async actions.
// if let Foreground::Deterministic { cx_id: _, executor } = self.cx.foreground().as_ref() { if let Foreground::Deterministic { cx_id: _, executor } = self.cx.foreground().as_ref() {
// executor.run_until_parked(); executor.run_until_parked();
// } else { } else {
// unreachable!(); unreachable!();
// } }
// keystrokes_under_test_handle keystrokes_under_test_handle
// } }
// pub fn ranges(&self, marked_text: &str) -> Vec<Range<usize>> { pub fn ranges(&self, marked_text: &str) -> Vec<Range<usize>> {
// let (unmarked_text, ranges) = marked_text_ranges(marked_text, false); let (unmarked_text, ranges) = marked_text_ranges(marked_text, false);
// assert_eq!(self.buffer_text(), unmarked_text); assert_eq!(self.buffer_text(), unmarked_text);
// ranges ranges
// } }
// pub fn display_point(&mut self, marked_text: &str) -> DisplayPoint { pub fn display_point(&mut self, marked_text: &str) -> DisplayPoint {
// let ranges = self.ranges(marked_text); let ranges = self.ranges(marked_text);
// let snapshot = self let snapshot = self
// .editor .editor
// .update(self.cx, |editor, cx| editor.snapshot(cx)); .update(self.cx, |editor, cx| editor.snapshot(cx));
// ranges[0].start.to_display_point(&snapshot) ranges[0].start.to_display_point(&snapshot)
// } }
// // Returns anchors for the current buffer using `«` and `»` // Returns anchors for the current buffer using `«` and `»`
// pub fn text_anchor_range(&self, marked_text: &str) -> Range<language::Anchor> { pub fn text_anchor_range(&self, marked_text: &str) -> Range<language::Anchor> {
// let ranges = self.ranges(marked_text); let ranges = self.ranges(marked_text);
// let snapshot = self.buffer_snapshot(); let snapshot = self.buffer_snapshot();
// snapshot.anchor_before(ranges[0].start)..snapshot.anchor_after(ranges[0].end) snapshot.anchor_before(ranges[0].start)..snapshot.anchor_after(ranges[0].end)
// } }
// pub fn set_diff_base(&mut self, diff_base: Option<&str>) { pub fn set_diff_base(&mut self, diff_base: Option<&str>) {
// let diff_base = diff_base.map(String::from); let diff_base = diff_base.map(String::from);
// self.update_buffer(|buffer, cx| buffer.set_diff_base(diff_base, cx)); self.update_buffer(|buffer, cx| buffer.set_diff_base(diff_base, cx));
// } }
// /// Change the editor's text and selections using a string containing /// Change the editor's text and selections using a string containing
// /// embedded range markers that represent the ranges and directions of /// embedded range markers that represent the ranges and directions of
// /// each selection. /// each selection.
// /// ///
// /// Returns a context handle so that assertion failures can print what /// Returns a context handle so that assertion failures can print what
// /// editor state was needed to cause the failure. /// editor state was needed to cause the failure.
// /// ///
// /// See the `util::test::marked_text_ranges` function for more information. /// See the `util::test::marked_text_ranges` function for more information.
// pub fn set_state(&mut self, marked_text: &str) -> ContextHandle { pub fn set_state(&mut self, marked_text: &str) -> ContextHandle {
// let state_context = self.add_assertion_context(format!( let state_context = self.add_assertion_context(format!(
// "Initial Editor State: \"{}\"", "Initial Editor State: \"{}\"",
// marked_text.escape_debug().to_string() marked_text.escape_debug().to_string()
// )); ));
// let (unmarked_text, selection_ranges) = marked_text_ranges(marked_text, true); let (unmarked_text, selection_ranges) = marked_text_ranges(marked_text, true);
// self.editor.update(self.cx, |editor, cx| { self.editor.update(self.cx, |editor, cx| {
// editor.set_text(unmarked_text, cx); editor.set_text(unmarked_text, cx);
// editor.change_selections(Some(Autoscroll::fit()), cx, |s| { editor.change_selections(Some(Autoscroll::fit()), cx, |s| {
// s.select_ranges(selection_ranges) s.select_ranges(selection_ranges)
// }) })
// }); });
// state_context state_context
// } }
// /// Only change the editor's selections /// Only change the editor's selections
// pub fn set_selections_state(&mut self, marked_text: &str) -> ContextHandle { pub fn set_selections_state(&mut self, marked_text: &str) -> ContextHandle {
// let state_context = self.add_assertion_context(format!( let state_context = self.add_assertion_context(format!(
// "Initial Editor State: \"{}\"", "Initial Editor State: \"{}\"",
// marked_text.escape_debug().to_string() marked_text.escape_debug().to_string()
// )); ));
// let (unmarked_text, selection_ranges) = marked_text_ranges(marked_text, true); let (unmarked_text, selection_ranges) = marked_text_ranges(marked_text, true);
// self.editor.update(self.cx, |editor, cx| { self.editor.update(self.cx, |editor, cx| {
// assert_eq!(editor.text(cx), unmarked_text); assert_eq!(editor.text(cx), unmarked_text);
// editor.change_selections(Some(Autoscroll::fit()), cx, |s| { editor.change_selections(Some(Autoscroll::fit()), cx, |s| {
// s.select_ranges(selection_ranges) s.select_ranges(selection_ranges)
// }) })
// }); });
// state_context state_context
// } }
// /// Make an assertion about the editor's text and the ranges and directions /// Make an assertion about the editor's text and the ranges and directions
// /// of its selections using a string containing embedded range markers. /// of its selections using a string containing embedded range markers.
// /// ///
// /// See the `util::test::marked_text_ranges` function for more information. /// See the `util::test::marked_text_ranges` function for more information.
// #[track_caller] #[track_caller]
// pub fn assert_editor_state(&mut self, marked_text: &str) { pub fn assert_editor_state(&mut self, marked_text: &str) {
// let (unmarked_text, expected_selections) = marked_text_ranges(marked_text, true); let (unmarked_text, expected_selections) = marked_text_ranges(marked_text, true);
// let buffer_text = self.buffer_text(); let buffer_text = self.buffer_text();
// if buffer_text != unmarked_text { if buffer_text != unmarked_text {
// panic!("Unmarked text doesn't match buffer text\nBuffer text: {buffer_text:?}\nUnmarked text: {unmarked_text:?}\nRaw buffer text\n{buffer_text}Raw unmarked text\n{unmarked_text}"); panic!("Unmarked text doesn't match buffer text\nBuffer text: {buffer_text:?}\nUnmarked text: {unmarked_text:?}\nRaw buffer text\n{buffer_text}Raw unmarked text\n{unmarked_text}");
// } }
// self.assert_selections(expected_selections, marked_text.to_string()) self.assert_selections(expected_selections, marked_text.to_string())
// } }
// pub fn editor_state(&mut self) -> String { pub fn editor_state(&mut self) -> String {
// generate_marked_text(self.buffer_text().as_str(), &self.editor_selections(), true) generate_marked_text(self.buffer_text().as_str(), &self.editor_selections(), true)
// } }
// #[track_caller] #[track_caller]
// pub fn assert_editor_background_highlights<Tag: 'static>(&mut self, marked_text: &str) { pub fn assert_editor_background_highlights<Tag: 'static>(&mut self, marked_text: &str) {
// let expected_ranges = self.ranges(marked_text); let expected_ranges = self.ranges(marked_text);
// let actual_ranges: Vec<Range<usize>> = self.update_editor(|editor, cx| { let actual_ranges: Vec<Range<usize>> = self.update_editor(|editor, cx| {
// let snapshot = editor.snapshot(cx); let snapshot = editor.snapshot(cx);
// editor editor
// .background_highlights .background_highlights
// .get(&TypeId::of::<Tag>()) .get(&TypeId::of::<Tag>())
// .map(|h| h.1.clone()) .map(|h| h.1.clone())
// .unwrap_or_default() .unwrap_or_default()
// .into_iter() .into_iter()
// .map(|range| range.to_offset(&snapshot.buffer_snapshot)) .map(|range| range.to_offset(&snapshot.buffer_snapshot))
// .collect() .collect()
// }); });
// assert_set_eq!(actual_ranges, expected_ranges); assert_set_eq!(actual_ranges, expected_ranges);
// } }
// #[track_caller] #[track_caller]
// pub fn assert_editor_text_highlights<Tag: ?Sized + 'static>(&mut self, marked_text: &str) { pub fn assert_editor_text_highlights<Tag: ?Sized + 'static>(&mut self, marked_text: &str) {
// let expected_ranges = self.ranges(marked_text); let expected_ranges = self.ranges(marked_text);
// let snapshot = self.update_editor(|editor, cx| editor.snapshot(cx)); let snapshot = self.update_editor(|editor, cx| editor.snapshot(cx));
// let actual_ranges: Vec<Range<usize>> = snapshot let actual_ranges: Vec<Range<usize>> = snapshot
// .text_highlight_ranges::<Tag>() .text_highlight_ranges::<Tag>()
// .map(|ranges| ranges.as_ref().clone().1) .map(|ranges| ranges.as_ref().clone().1)
// .unwrap_or_default() .unwrap_or_default()
// .into_iter() .into_iter()
// .map(|range| range.to_offset(&snapshot.buffer_snapshot)) .map(|range| range.to_offset(&snapshot.buffer_snapshot))
// .collect(); .collect();
// assert_set_eq!(actual_ranges, expected_ranges); assert_set_eq!(actual_ranges, expected_ranges);
// } }
// #[track_caller] #[track_caller]
// pub fn assert_editor_selections(&mut self, expected_selections: Vec<Range<usize>>) { pub fn assert_editor_selections(&mut self, expected_selections: Vec<Range<usize>>) {
// let expected_marked_text = let expected_marked_text =
// generate_marked_text(&self.buffer_text(), &expected_selections, true); generate_marked_text(&self.buffer_text(), &expected_selections, true);
// self.assert_selections(expected_selections, expected_marked_text) self.assert_selections(expected_selections, expected_marked_text)
// } }
// fn editor_selections(&self) -> Vec<Range<usize>> { fn editor_selections(&self) -> Vec<Range<usize>> {
// self.editor self.editor
// .read_with(self.cx, |editor, cx| editor.selections.all::<usize>(cx)) .read_with(self.cx, |editor, cx| editor.selections.all::<usize>(cx))
// .into_iter() .into_iter()
// .map(|s| { .map(|s| {
// if s.reversed { if s.reversed {
// s.end..s.start s.end..s.start
// } else { } else {
// s.start..s.end s.start..s.end
// } }
// }) })
// .collect::<Vec<_>>() .collect::<Vec<_>>()
// } }
// #[track_caller] #[track_caller]
// fn assert_selections( fn assert_selections(
// &mut self, &mut self,
// expected_selections: Vec<Range<usize>>, expected_selections: Vec<Range<usize>>,
// expected_marked_text: String, expected_marked_text: String,
// ) { ) {
// let actual_selections = self.editor_selections(); let actual_selections = self.editor_selections();
// let actual_marked_text = let actual_marked_text =
// generate_marked_text(&self.buffer_text(), &actual_selections, true); generate_marked_text(&self.buffer_text(), &actual_selections, true);
// if expected_selections != actual_selections { if expected_selections != actual_selections {
// panic!( panic!(
// indoc! {" indoc! {"
// {}Editor has unexpected selections. {}Editor has unexpected selections.
// Expected selections: Expected selections:
// {} {}
// Actual selections: Actual selections:
// {} {}
// "}, "},
// self.assertion_context(), self.assertion_context(),
// expected_marked_text, expected_marked_text,
// actual_marked_text, actual_marked_text,
// ); );
// } }
// } }
// } }
//
// impl<'a> Deref for EditorTestContext<'a> {
// type Target = gpui::TestAppContext;
// fn deref(&self) -> &Self::Target { impl<'a> Deref for EditorTestContext<'a> {
// self.cx type Target = gpui::TestAppContext;
// }
// }
// impl<'a> DerefMut for EditorTestContext<'a> { fn deref(&self) -> &Self::Target {
// fn deref_mut(&mut self) -> &mut Self::Target { self.cx
// &mut self.cx }
// } }
// }
impl<'a> DerefMut for EditorTestContext<'a> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.cx
}
}