+ #[test]
+ fn notifier_pre_notified_future() {
+ // Previously, if we generated a future after a `Notifier` had been notified, the future
+ // would never complete. This tests this behavior, ensuring the future instead completes
+ // immediately.
+ let notifier = Notifier::new();
+ notifier.notify();
+
+ let callback = Arc::new(AtomicBool::new(false));
+ let callback_ref = Arc::clone(&callback);
+ notifier.get_future().register_callback(Box::new(move || assert!(!callback_ref.fetch_or(true, Ordering::SeqCst))));
+ assert!(callback.load(Ordering::SeqCst));
+ }
+