From b9a917f42a932f75d94c03166935eee8f233790e Mon Sep 17 00:00:00 2001 From: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com> Date: Mon, 4 Dec 2023 15:31:35 +0100 Subject: [PATCH] Fix up condition not checking the condition at the start. Co-authored-by: Antonio --- crates/gpui2/src/app/test_context.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/gpui2/src/app/test_context.rs b/crates/gpui2/src/app/test_context.rs index c915753749f4f85bb75cf1440df0775b232d7fa4..908a418635bfe7262b69a6ced0344c4484bd89dd 100644 --- a/crates/gpui2/src/app/test_context.rs +++ b/crates/gpui2/src/app/test_context.rs @@ -343,12 +343,15 @@ impl TestAppContext { use smol::future::FutureExt as _; async { - while notifications.next().await.is_some() { + loop { if model.update(self, &mut predicate) { return Ok(()); } + + if notifications.next().await.is_none() { + bail!("model dropped") + } } - bail!("model dropped") } .race(timer.map(|_| Err(anyhow!("condition timed out")))) .await