use super::SourceNotifyGuard;
use crate::parking::ThreadParker;
#[test]
fn test_source_notify_guard_drop_notifies_only_when_armed() {
let mut parker = ThreadParker::new();
assert!(parker.take_notification(), "清掉创建时的初始通知");
let notifier = parker.notifier();
let armed = SourceNotifyGuard { notifier: ¬ifier, armed: true };
drop(armed);
assert!(parker.is_notified(), "未结清守卫须补一次线程检查");
assert!(parker.take_notification());
let disarmed = SourceNotifyGuard { notifier: ¬ifier, armed: false };
drop(disarmed);
assert!(!parker.is_notified(), "已结清不得重复通知");
}