mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-26 12:21:50 +00:00
Remove commented-out tests for spawn and spawn_stream
This commit is contained in:
parent
a3be5595dd
commit
d6c89521d9
1 changed files with 0 additions and 134 deletions
134
gpui/src/app.rs
134
gpui/src/app.rs
|
@ -2764,61 +2764,6 @@ mod tests {
|
|||
assert_eq!(handle_1.read(app).events, vec![7, 10, 5])
|
||||
}
|
||||
|
||||
// #[crate::test(self)]
|
||||
// async fn test_spawn_from_model(mut app: TestAppContext) {
|
||||
// #[derive(Default)]
|
||||
// struct Model {
|
||||
// count: usize,
|
||||
// }
|
||||
|
||||
// impl Entity for Model {
|
||||
// type Event = ();
|
||||
// }
|
||||
|
||||
// let handle = app.add_model(|_| Model::default());
|
||||
// handle
|
||||
// .update(&mut app, |_, c| {
|
||||
// c.spawn(async { 7 }, |model, output, _| {
|
||||
// model.count = output;
|
||||
// })
|
||||
// })
|
||||
// .await;
|
||||
// app.read(|ctx| assert_eq!(handle.read(ctx).count, 7));
|
||||
|
||||
// handle
|
||||
// .update(&mut app, |_, c| {
|
||||
// c.spawn(async { 14 }, |model, output, _| {
|
||||
// model.count = output;
|
||||
// })
|
||||
// })
|
||||
// .await;
|
||||
// app.read(|ctx| assert_eq!(handle.read(ctx).count, 14));
|
||||
// }
|
||||
|
||||
// #[crate::test(self)]
|
||||
// async fn test_spawn_stream_local_from_model(mut app: TestAppContext) {
|
||||
// #[derive(Default)]
|
||||
// struct Model {
|
||||
// events: Vec<Option<usize>>,
|
||||
// }
|
||||
|
||||
// impl Entity for Model {
|
||||
// type Event = ();
|
||||
// }
|
||||
|
||||
// let handle = app.add_model(|_| Model::default());
|
||||
// handle
|
||||
// .update(&mut app, |_, c| {
|
||||
// c.spawn_stream(
|
||||
// smol::stream::iter(vec![1, 2, 3]),
|
||||
// |model, output, _| model.events.push(Some(output)),
|
||||
// |model, _| model.events.push(None),
|
||||
// )
|
||||
// })
|
||||
// .await;
|
||||
// app.read(|ctx| assert_eq!(handle.read(ctx).events, [Some(1), Some(2), Some(3), None]));
|
||||
// }
|
||||
|
||||
#[crate::test(self)]
|
||||
fn test_view_handles(app: &mut MutableAppContext) {
|
||||
struct View {
|
||||
|
@ -3135,85 +3080,6 @@ mod tests {
|
|||
);
|
||||
}
|
||||
|
||||
// #[crate::test(self)]
|
||||
// async fn test_spawn_from_view(mut app: TestAppContext) {
|
||||
// #[derive(Default)]
|
||||
// struct View {
|
||||
// count: usize,
|
||||
// }
|
||||
|
||||
// impl Entity for View {
|
||||
// type Event = ();
|
||||
// }
|
||||
|
||||
// impl super::View for View {
|
||||
// fn render<'a>(&self, _: &AppContext) -> ElementBox {
|
||||
// Empty::new().boxed()
|
||||
// }
|
||||
|
||||
// fn ui_name() -> &'static str {
|
||||
// "View"
|
||||
// }
|
||||
// }
|
||||
|
||||
// let handle = app.add_window(|_| View::default()).1;
|
||||
// handle
|
||||
// .update(&mut app, |_, c| {
|
||||
// c.spawn(async { 7 }, |me, output, _| {
|
||||
// me.count = output;
|
||||
// })
|
||||
// })
|
||||
// .await;
|
||||
// app.read(|ctx| assert_eq!(handle.read(ctx).count, 7));
|
||||
// handle
|
||||
// .update(&mut app, |_, c| {
|
||||
// c.spawn(async { 14 }, |me, output, _| {
|
||||
// me.count = output;
|
||||
// })
|
||||
// })
|
||||
// .await;
|
||||
// app.read(|ctx| assert_eq!(handle.read(ctx).count, 14));
|
||||
// }
|
||||
|
||||
// #[crate::test(self)]
|
||||
// async fn test_spawn_stream_local_from_view(mut app: TestAppContext) {
|
||||
// #[derive(Default)]
|
||||
// struct View {
|
||||
// events: Vec<Option<usize>>,
|
||||
// }
|
||||
|
||||
// impl Entity for View {
|
||||
// type Event = ();
|
||||
// }
|
||||
|
||||
// impl super::View for View {
|
||||
// fn render<'a>(&self, _: &AppContext) -> ElementBox {
|
||||
// Empty::new().boxed()
|
||||
// }
|
||||
|
||||
// fn ui_name() -> &'static str {
|
||||
// "View"
|
||||
// }
|
||||
// }
|
||||
|
||||
// let (_, handle) = app.add_window(|_| View::default());
|
||||
// handle
|
||||
// .update(&mut app, |_, c| {
|
||||
// c.spawn_stream(
|
||||
// smol::stream::iter(vec![1_usize, 2, 3]),
|
||||
// |me, output, _| {
|
||||
// me.events.push(Some(output));
|
||||
// },
|
||||
// |me, _| {
|
||||
// me.events.push(None);
|
||||
// },
|
||||
// )
|
||||
// })
|
||||
// .await;
|
||||
|
||||
// app.read(|ctx| assert_eq!(handle.read(ctx).events, [Some(1), Some(2), Some(3), None]))
|
||||
// }
|
||||
|
||||
#[crate::test(self)]
|
||||
fn test_dispatch_action(app: &mut MutableAppContext) {
|
||||
struct ViewA {
|
||||
|
|
Loading…
Reference in a new issue