diff --git a/seastar/src/timer.rs b/seastar/src/timer.rs index c4a857a..3d7c9c2 100644 --- a/seastar/src/timer.rs +++ b/seastar/src/timer.rs @@ -304,6 +304,24 @@ mod tests { assert!(*calls.borrow() == 2); } + #[seastar::test] + async fn []() { + let mut timer = Timer::<$Clock>::new(); + + let calls = Rc::new(RefCell::new(0)); + let calls_cloned = calls.clone(); + let callback = move || { + *calls_cloned.borrow_mut() += 1; + }; + let sg = SchedulingGroup::create("sg", 100.).await; + timer.set_callback_under_group(callback, &sg); + + let duration = Duration::from_millis(100); + timer.arm(duration); + + [](&mut timer, duration, calls).await; + } + #[seastar::test] async fn []() { let (mut timer, duration, calls) = []();