Start removing the Send impl for App
Co-authored-by: Antonio <antonio@zed.dev> Co-authored-by: Nathan <nathan@zed.dev>
This commit is contained in:
parent
ea7fdef417
commit
57ffa8201e
38 changed files with 506 additions and 932 deletions
|
@ -215,58 +215,3 @@ impl PlatformDispatcher for TestDispatcher {
|
|||
Some(self)
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
use crate::Executor;
|
||||
use std::sync::Arc;
|
||||
|
||||
#[test]
|
||||
fn test_dispatch() {
|
||||
let dispatcher = TestDispatcher::new(StdRng::seed_from_u64(0));
|
||||
let executor = Executor::new(Arc::new(dispatcher));
|
||||
|
||||
let result = executor.block(async { executor.run_on_main(|| 1).await });
|
||||
assert_eq!(result, 1);
|
||||
|
||||
let result = executor.block({
|
||||
let executor = executor.clone();
|
||||
async move {
|
||||
executor
|
||||
.spawn_on_main({
|
||||
let executor = executor.clone();
|
||||
assert!(executor.is_main_thread());
|
||||
|| async move {
|
||||
assert!(executor.is_main_thread());
|
||||
let result = executor
|
||||
.spawn({
|
||||
let executor = executor.clone();
|
||||
async move {
|
||||
assert!(!executor.is_main_thread());
|
||||
|
||||
let result = executor
|
||||
.spawn_on_main({
|
||||
let executor = executor.clone();
|
||||
|| async move {
|
||||
assert!(executor.is_main_thread());
|
||||
2
|
||||
}
|
||||
})
|
||||
.await;
|
||||
|
||||
assert!(!executor.is_main_thread());
|
||||
result
|
||||
}
|
||||
})
|
||||
.await;
|
||||
assert!(executor.is_main_thread());
|
||||
result
|
||||
}
|
||||
})
|
||||
.await
|
||||
}
|
||||
});
|
||||
assert_eq!(result, 2);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue