Clear the executor at the end of a test by running until it is parked

Max Brunsfeld created

Change summary

crates/gpui/src/executor.rs | 2 +-
crates/gpui/src/test.rs     | 1 +
2 files changed, 2 insertions(+), 1 deletion(-)

Detailed changes

crates/gpui/src/executor.rs 🔗

@@ -174,7 +174,7 @@ impl Deterministic {
         }
     }
 
-    fn run_until_parked(&self) {
+    pub(crate) fn run_until_parked(&self) {
         let woken = Arc::new(AtomicBool::new(false));
         self.run_internal(woken, None);
     }

crates/gpui/src/test.rs 🔗

@@ -84,6 +84,7 @@ pub fn run_test(
                     )
                 });
 
+                deterministic.run_until_parked();
                 leak_detector.lock().detect();
                 if is_last_iteration {
                     break;