first pass of merging in warp (doesn't build)
This commit is contained in:
@@ -1,13 +1,15 @@
|
||||
use crate::on_cancel::OnCancelFutureExt;
|
||||
use futures_util::future::{AbortHandle, Abortable, Aborted};
|
||||
use std::sync::atomic::{AtomicBool, Ordering};
|
||||
|
||||
use futures_util::future::{AbortHandle, Abortable, Aborted};
|
||||
|
||||
use crate::on_cancel::OnCancelFutureExt;
|
||||
|
||||
#[test]
|
||||
fn test_ready_future_doesnt_call_callback() {
|
||||
let callback_called = AtomicBool::new(false);
|
||||
|
||||
let future = async {}.on_cancel(|| callback_called.store(true, Ordering::SeqCst));
|
||||
galaxyui::r#async::block_on(future);
|
||||
galaxyui_core::r#async::block_on(future);
|
||||
|
||||
assert!(!callback_called.load(Ordering::Relaxed));
|
||||
}
|
||||
@@ -24,7 +26,7 @@ fn test_aborted_future_calls_callback() {
|
||||
|
||||
// Abort the future before it is ever polled.
|
||||
handle.abort();
|
||||
let future_result = galaxyui::r#async::block_on(future);
|
||||
let future_result = galaxyui_core::r#async::block_on(future);
|
||||
|
||||
// The future should be aborted and the callback should have been called.
|
||||
assert_eq!(future_result, Err(Aborted));
|
||||
|
||||
Reference in New Issue
Block a user