File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -447,8 +447,8 @@ mod tests {
447447
448448 // If we get a future and don't touch it we're definitely still notify-required.
449449 notifier. get_future ( ) ;
450- assert ! ( notifier. wait_timeout( Duration :: from_secs ( 1 ) ) ) ;
451- assert ! ( !notifier. wait_timeout( Duration :: from_secs ( 1 ) ) ) ;
450+ assert ! ( notifier. wait_timeout( Duration :: from_millis ( 1 ) ) ) ;
451+ assert ! ( !notifier. wait_timeout( Duration :: from_millis ( 1 ) ) ) ;
452452
453453 // Even if we poll'd once but didn't observe a `Ready`, we should be notify-required.
454454 let mut future = notifier. get_future ( ) ;
@@ -457,10 +457,16 @@ mod tests {
457457
458458 notifier. notify ( ) ;
459459 assert ! ( woken. load( Ordering :: SeqCst ) ) ;
460- assert ! ( notifier. wait_timeout( Duration :: from_secs ( 1 ) ) ) ;
460+ assert ! ( notifier. wait_timeout( Duration :: from_millis ( 1 ) ) ) ;
461461
462- notifier. notify ( ) ;
462+ // However, once we do poll `Ready` it should wipe the notify-required flag.
463+ let mut future = notifier. get_future ( ) ;
464+ let ( woken, waker) = create_waker ( ) ;
465+ assert_eq ! ( Pin :: new( & mut future) . poll( & mut Context :: from_waker( & waker) ) , Poll :: Pending ) ;
463466
464467 notifier. notify ( ) ;
468+ assert ! ( woken. load( Ordering :: SeqCst ) ) ;
469+ assert_eq ! ( Pin :: new( & mut future) . poll( & mut Context :: from_waker( & waker) ) , Poll :: Ready ( ( ) ) ) ;
470+ assert ! ( !notifier. wait_timeout( Duration :: from_millis( 1 ) ) ) ;
465471 }
466472}
You can’t perform that action at this time.
0 commit comments