MCPcopy Create free account
hub / github.com/AI45Lab/Code / test_write_or_recover_poisoned

Function test_write_or_recover_poisoned

core/src/error.rs:237–246  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

235
236 #[test]
237 fn test_write_or_recover_poisoned() {
238 let lock = std::sync::RwLock::new(42);
239 let _ = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {
240 let _guard = lock.write().unwrap();
241 panic!("intentional poison");
242 }));
243 let mut guard = write_or_recover(&lock);
244 *guard = 100;
245 assert_eq!(*guard, 100);
246 }
247}

Callers

nothing calls this directly

Calls 2

write_or_recoverFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected