Tidy up TestContext lifecycle

Co-Authored-By: Max <max@zed.dev>
This commit is contained in:
Conrad Irwin
2024-01-05 16:31:41 -07:00
co-authored by Max
parent c7568a7d37
commit 709682e8bc
10 changed files with 82 additions and 78 deletions
@@ -26,15 +26,15 @@ use util::{
use super::build_editor_with_project;
pub struct EditorTestContext<'a> {
pub cx: gpui::VisualTestContext<'a>,
pub struct EditorTestContext {
pub cx: gpui::VisualTestContext,
pub window: AnyWindowHandle,
pub editor: View<Editor>,
pub assertion_cx: AssertionContextManager,
}
impl<'a> EditorTestContext<'a> {
pub async fn new(cx: &'a mut gpui::TestAppContext) -> EditorTestContext<'a> {
impl EditorTestContext {
pub async fn new(cx: &mut gpui::TestAppContext) -> EditorTestContext {
let fs = FakeFs::new(cx.executor());
// fs.insert_file("/file", "".to_owned()).await;
fs.insert_tree(
@@ -342,7 +342,7 @@ impl<'a> EditorTestContext<'a> {
}
}
impl<'a> Deref for EditorTestContext<'a> {
impl Deref for EditorTestContext {
type Target = gpui::TestAppContext;
fn deref(&self) -> &Self::Target {
@@ -350,7 +350,7 @@ impl<'a> Deref for EditorTestContext<'a> {
}
}
impl<'a> DerefMut for EditorTestContext<'a> {
impl DerefMut for EditorTestContext {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.cx
}