Get language2 tests passing by not blocking on a foreground task
This commit is contained in:
parent
53066df522
commit
57dfc50687
4 changed files with 6 additions and 11 deletions
|
@ -4,7 +4,7 @@ use crate::{
|
||||||
WindowContext,
|
WindowContext,
|
||||||
};
|
};
|
||||||
use anyhow::{anyhow, bail};
|
use anyhow::{anyhow, bail};
|
||||||
use futures::{SinkExt, Stream, StreamExt};
|
use futures::{Stream, StreamExt};
|
||||||
use std::{cell::RefCell, future::Future, rc::Rc, sync::Arc, time::Duration};
|
use std::{cell::RefCell, future::Future, rc::Rc, sync::Arc, time::Duration};
|
||||||
|
|
||||||
#[derive(Clone)]
|
#[derive(Clone)]
|
||||||
|
@ -165,13 +165,11 @@ impl TestAppContext {
|
||||||
where
|
where
|
||||||
T::Event: 'static + Clone,
|
T::Event: 'static + Clone,
|
||||||
{
|
{
|
||||||
let (mut tx, rx) = futures::channel::mpsc::unbounded();
|
let (tx, rx) = futures::channel::mpsc::unbounded();
|
||||||
entity
|
entity
|
||||||
.update(self, |_, cx: &mut ModelContext<T>| {
|
.update(self, |_, cx: &mut ModelContext<T>| {
|
||||||
cx.subscribe(entity, move |_, _, event, cx| {
|
cx.subscribe(entity, move |_model, _handle, event, _cx| {
|
||||||
cx.background_executor()
|
let _ = tx.unbounded_send(event.clone());
|
||||||
.block(tx.send(event.clone()))
|
|
||||||
.unwrap();
|
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
.detach();
|
.detach();
|
||||||
|
|
|
@ -36,10 +36,6 @@ pub fn derive_component(input: TokenStream) -> TokenStream {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
if name == "CollabPanel" {
|
|
||||||
println!("{}", expanded)
|
|
||||||
}
|
|
||||||
|
|
||||||
TokenStream::from(expanded)
|
TokenStream::from(expanded)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -434,7 +434,7 @@ impl Buffer {
|
||||||
));
|
));
|
||||||
|
|
||||||
let text_operations = self.text.operations().clone();
|
let text_operations = self.text.operations().clone();
|
||||||
cx.spawn(|_| async move {
|
cx.background_executor().spawn(async move {
|
||||||
let since = since.unwrap_or_default();
|
let since = since.unwrap_or_default();
|
||||||
operations.extend(
|
operations.extend(
|
||||||
text_operations
|
text_operations
|
||||||
|
|
|
@ -1943,6 +1943,7 @@ fn test_random_collaboration(cx: &mut AppContext, mut rng: StdRng) {
|
||||||
.detach();
|
.detach();
|
||||||
buffer
|
buffer
|
||||||
});
|
});
|
||||||
|
|
||||||
buffers.push(buffer);
|
buffers.push(buffer);
|
||||||
replica_ids.push(i as ReplicaId);
|
replica_ids.push(i as ReplicaId);
|
||||||
network.lock().add_peer(i as ReplicaId);
|
network.lock().add_peer(i as ReplicaId);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue