Implement start/finish waiting for gpui2
I'm not sure these are strictly necessary, but it will make porting tests easier to have them.
This commit is contained in:
parent
0e9a82711c
commit
8db6b78fdd
2 changed files with 26 additions and 3 deletions
|
@ -161,7 +161,12 @@ impl Executor {
|
|||
#[cfg(any(test, feature = "test-support"))]
|
||||
if let Some(test) = self.dispatcher.as_test() {
|
||||
if !test.parking_allowed() {
|
||||
panic!("blocked with nothing left to run")
|
||||
let mut backtrace_message = String::new();
|
||||
if let Some(backtrace) = test.waiting_backtrace() {
|
||||
backtrace_message =
|
||||
format!("\nbacktrace of waiting future:\n{:?}", backtrace);
|
||||
}
|
||||
panic!("parked with nothing left to run\n{:?}", backtrace_message)
|
||||
}
|
||||
}
|
||||
parker.park();
|
||||
|
@ -220,12 +225,12 @@ impl Executor {
|
|||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub fn start_waiting(&self) {
|
||||
todo!("start_waiting")
|
||||
self.dispatcher.as_test().unwrap().start_waiting();
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
pub fn finish_waiting(&self) {
|
||||
todo!("finish_waiting")
|
||||
self.dispatcher.as_test().unwrap().finish_waiting();
|
||||
}
|
||||
|
||||
#[cfg(any(test, feature = "test-support"))]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue