use super::*; #[tokio::test] async fn async_test_u8_panic() { let receiver: Access>, Suspending> = Default::default(); let sender: Access>, Blocking> = Arc::clone(&receiver).into(); let handle = thread::spawn(move || { let editor: Editor = sender.edit().unwrap(); intentionally_panic_while_holding(editor); }); assert!(receiver.result().await.is_err()); assert!(!receiver.edit().await.unwrap_err().into_inner().has()); await_completion_non_blocking(handle).await } #[tokio::test] async fn async_test_u8_transfer_panic() { let instant_receiver: Access>, Instantly> = Default::default(); let suspending_receiver: Access<&Rusturn, _> = instant_receiver.suspending_access(); let sender: Access>, Instantly> = Arc::clone(&instant_receiver).into(); let handle = thread::spawn(move || { let mut editor: Editor = sender.try_edit().unwrap(); editor.set(43u8); intentionally_panic_while_holding(editor); }); assert!(suspending_receiver.receive().await.is_err()); match instant_receiver.try_take() { Err(TryAccessError::Poisoned(err)) => { assert_eq!(err.into_inner().take(), Some(43u8)); } _ => unreachable!("Should be poisoned"), } await_completion_non_blocking(handle).await }