From c09921e790c1949a86e7fcc5dfca213b0cf2594c Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 28 Feb 2022 22:20:03 -0800 Subject: [PATCH] Clear the executor at the end of a test by running until it is parked --- crates/gpui/src/executor.rs | 2 +- crates/gpui/src/test.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/gpui/src/executor.rs b/crates/gpui/src/executor.rs index eb58edd109..79877029e0 100644 --- a/crates/gpui/src/executor.rs +++ b/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); } diff --git a/crates/gpui/src/test.rs b/crates/gpui/src/test.rs index 056c8d70a1..57875383ee 100644 --- a/crates/gpui/src/test.rs +++ b/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;