From 9d58f44258e20225c3ec13dca9638000fa330829 Mon Sep 17 00:00:00 2001 From: Jan Haller Date: Sun, 8 Dec 2024 16:07:08 +0100 Subject: [PATCH] + --- .../builtin_tests/containers/callable_test.rs | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/itest/rust/src/builtin_tests/containers/callable_test.rs b/itest/rust/src/builtin_tests/containers/callable_test.rs index 73362f41d..49e14833f 100644 --- a/itest/rust/src/builtin_tests/containers/callable_test.rs +++ b/itest/rust/src/builtin_tests/containers/callable_test.rs @@ -195,7 +195,6 @@ pub mod custom_callable { } // Without this feature, any access to the global binding from another thread fails; so the from_local_fn() cannot be tested in isolation. - // #[cfg(feature = "experimental-threads")] #[itest] fn callable_from_local_fn_crossthread() { // This static is a workaround for not being able to propagate failed `Callable` invocations as panics. @@ -212,14 +211,26 @@ pub mod custom_callable { let crosser = ThreadCrosser::new(callable); // Create separate thread and ensure calling fails. - // expect_panic( - // "Callable created with from_local_fn() must panic when invoked on other thread", - // ||{ + #[cfg(not(feature = "experimental-threads"))] + crate::framework::expect_panic( + "Callable created with from_local_fn() must panic when invoked on other thread", + || { + quick_thread(|| { + let callable = unsafe { crosser.extract() }; + println!("before call"); + callable.callv(&varray![5]); + println!("after call"); + }); + }, + ); + + #[cfg(feature = "experimental-threads")] quick_thread(|| { let callable = unsafe { crosser.extract() }; + println!("before call"); callable.callv(&varray![5]); + println!("after call"); }); - // ,); // We should really use expect_panic here (AROUND quick_thread, not inside), however we currently can't catch panics, see above. // Instead, we check the global value.