From 921be53241cde52ef63e9e74fb14a63a988e56ec Mon Sep 17 00:00:00 2001 From: Kirill Bulatov Date: Tue, 4 Nov 2025 00:38:38 +0200 Subject: [PATCH] Remove incorrectly added test During cherry-picking of https://github.com/zed-industries/zed/pull/41859 , one test was incorrectly merged in. This was only added in https://github.com/zed-industries/zed/pull/41342 which is not cherry-picked, hence the test will fail. --- crates/outline_panel/src/outline_panel.rs | 233 ---------------------- 1 file changed, 233 deletions(-) diff --git a/crates/outline_panel/src/outline_panel.rs b/crates/outline_panel/src/outline_panel.rs index a9a8d217a229b564a3e7d8b6963334c08ff718f3..c40186c7defebebfea255161428fc12de7eaf145 100644 --- a/crates/outline_panel/src/outline_panel.rs +++ b/crates/outline_panel/src/outline_panel.rs @@ -7575,239 +7575,6 @@ outline: fn main()" }); } - #[gpui::test] - async fn test_outline_expand_collapse_all(cx: &mut TestAppContext) { - init_test(cx); - - let fs = FakeFs::new(cx.background_executor.clone()); - fs.insert_tree( - "/test", - json!({ - "src": { - "lib.rs": indoc!(" - mod outer { - pub struct OuterStruct { - field: String, - } - impl OuterStruct { - pub fn new() -> Self { - Self { field: String::new() } - } - pub fn method(&self) { - println!(\"{}\", self.field); - } - } - mod inner { - pub fn inner_function() { - let x = 42; - println!(\"{}\", x); - } - pub struct InnerStruct { - value: i32, - } - } - } - fn main() { - let s = outer::OuterStruct::new(); - s.method(); - } - "), - } - }), - ) - .await; - - let project = Project::test(fs.clone(), ["/test".as_ref()], cx).await; - project.read_with(cx, |project, _| { - project.languages().add(Arc::new( - rust_lang() - .with_outline_query( - r#" - (struct_item - (visibility_modifier)? @context - "struct" @context - name: (_) @name) @item - (impl_item - "impl" @context - trait: (_)? @context - "for"? @context - type: (_) @context - body: (_)) @item - (function_item - (visibility_modifier)? @context - "fn" @context - name: (_) @name - parameters: (_) @context) @item - (mod_item - (visibility_modifier)? @context - "mod" @context - name: (_) @name) @item - (enum_item - (visibility_modifier)? @context - "enum" @context - name: (_) @name) @item - (field_declaration - (visibility_modifier)? @context - name: (_) @name - ":" @context - type: (_) @context) @item - "#, - ) - .unwrap(), - )) - }); - let workspace = add_outline_panel(&project, cx).await; - let cx = &mut VisualTestContext::from_window(*workspace, cx); - let outline_panel = outline_panel(&workspace, cx); - - outline_panel.update_in(cx, |outline_panel, window, cx| { - outline_panel.set_active(true, window, cx) - }); - - workspace - .update(cx, |workspace, window, cx| { - workspace.open_abs_path( - PathBuf::from("/test/src/lib.rs"), - OpenOptions { - visible: Some(OpenVisible::All), - ..Default::default() - }, - window, - cx, - ) - }) - .unwrap() - .await - .unwrap(); - - cx.executor() - .advance_clock(UPDATE_DEBOUNCE + Duration::from_millis(500)); - cx.run_until_parked(); - - // Force another update cycle to ensure outlines are fetched - outline_panel.update_in(cx, |panel, window, cx| { - panel.update_non_fs_items(window, cx); - panel.update_cached_entries(Some(UPDATE_DEBOUNCE), window, cx); - }); - cx.executor() - .advance_clock(UPDATE_DEBOUNCE + Duration::from_millis(500)); - cx.run_until_parked(); - - outline_panel.update(cx, |outline_panel, cx| { - assert_eq!( - display_entries( - &project, - &snapshot(outline_panel, cx), - &outline_panel.cached_entries, - outline_panel.selected_entry(), - cx, - ), - indoc!( - " -outline: mod outer <==== selected - outline: pub struct OuterStruct - outline: field: String - outline: impl OuterStruct - outline: pub fn new() - outline: pub fn method(&self) - outline: mod inner - outline: pub fn inner_function() - outline: pub struct InnerStruct - outline: value: i32 -outline: fn main()" - ) - ); - }); - - let _parent_outline = outline_panel - .read_with(cx, |panel, _cx| { - panel - .cached_entries - .iter() - .find_map(|entry| match &entry.entry { - PanelEntry::Outline(OutlineEntry::Outline(outline)) - if panel - .outline_children_cache - .get(&outline.buffer_id) - .and_then(|children_map| { - let key = - (outline.outline.range.clone(), outline.outline.depth); - children_map.get(&key) - }) - .copied() - .unwrap_or(false) => - { - Some(entry.entry.clone()) - } - _ => None, - }) - }) - .expect("Should find an outline with children"); - - // Collapse all entries - outline_panel.update_in(cx, |panel, window, cx| { - panel.collapse_all_entries(&CollapseAllEntries, window, cx); - }); - cx.executor() - .advance_clock(UPDATE_DEBOUNCE + Duration::from_millis(100)); - cx.run_until_parked(); - - let expected_collapsed_output = indoc!( - " - outline: mod outer <==== selected - outline: fn main()" - ); - - outline_panel.update(cx, |panel, cx| { - assert_eq! { - display_entries( - &project, - &snapshot(panel, cx), - &panel.cached_entries, - panel.selected_entry(), - cx, - ), - expected_collapsed_output - }; - }); - - // Expand all entries - outline_panel.update_in(cx, |panel, window, cx| { - panel.expand_all_entries(&ExpandAllEntries, window, cx); - }); - cx.executor() - .advance_clock(UPDATE_DEBOUNCE + Duration::from_millis(100)); - cx.run_until_parked(); - - let expected_expanded_output = indoc!( - " - outline: mod outer <==== selected - outline: pub struct OuterStruct - outline: field: String - outline: impl OuterStruct - outline: pub fn new() - outline: pub fn method(&self) - outline: mod inner - outline: pub fn inner_function() - outline: pub struct InnerStruct - outline: value: i32 - outline: fn main()" - ); - - outline_panel.update(cx, |panel, cx| { - assert_eq! { - display_entries( - &project, - &snapshot(panel, cx), - &panel.cached_entries, - panel.selected_entry(), - cx, - ), - expected_expanded_output - }; - }); - } - #[gpui::test] async fn test_buffer_search(cx: &mut TestAppContext) { init_test(cx);