More tests (#285)

This commit is contained in:
Nikolay Kim 2024-01-19 16:05:07 +06:00 committed by GitHub
parent 5a04548e13
commit e8c175a17f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 84 additions and 18 deletions

View file

@ -117,6 +117,8 @@ mod tests {
Poll::Pending
);
cond.notify();
assert!(format!("{:?}", cond).contains("Condition"));
assert!(format!("{:?}", waiter).contains("Waiter"));
assert_eq!(waiter.await, ());
let mut waiter = cond.wait();
@ -145,10 +147,14 @@ mod tests {
let waiter2 = waiter.clone();
assert_eq!(lazy(|cx| waiter.poll_ready(cx)).await, Poll::Pending);
assert_eq!(lazy(|cx| waiter.poll_ready(cx)).await, Poll::Pending);
assert_eq!(lazy(|cx| waiter2.poll_ready(cx)).await, Poll::Pending);
assert_eq!(lazy(|cx| waiter2.poll_ready(cx)).await, Poll::Pending);
drop(cond);
assert_eq!(lazy(|cx| waiter.poll_ready(cx)).await, Poll::Ready(()));
assert_eq!(lazy(|cx| waiter.poll_ready(cx)).await, Poll::Pending);
assert_eq!(lazy(|cx| waiter2.poll_ready(cx)).await, Poll::Ready(()));
assert_eq!(lazy(|cx| waiter2.poll_ready(cx)).await, Poll::Pending);
}
}