From 22b256054ab8cb1c75125fe0b227c87b4b0ba7eb Mon Sep 17 00:00:00 2001 From: Mads Marquart Date: Thu, 14 Nov 2024 15:19:45 +0100 Subject: [PATCH] Fix throw_catch_raise_catch test in old runtime --- crates/tests/src/exception.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/crates/tests/src/exception.rs b/crates/tests/src/exception.rs index ddcee0018..0b5fdd3c1 100644 --- a/crates/tests/src/exception.rs +++ b/crates/tests/src/exception.rs @@ -42,9 +42,13 @@ fn throw_catch_raise_catch() { let exc = NSException::from_exception(res.unwrap_err().unwrap()).unwrap(); - // Undesired: The inner pool _should_ have been drained on unwind, but - // it isn't, see `rc::Pool::drain`. - assert_eq!(exc.retainCount(), 2); + if cfg!(all(target_os = "macos", target_arch = "x86")) { + assert_eq!(exc.retainCount(), 1); + } else { + // Undesired: The inner pool _should_ have been drained on unwind, + // but it isn't in newer runtimes, see docs on `rc::Pool::drain`. + assert_eq!(exc.retainCount(), 2); + } exc });