Skip to content

Commit

Permalink
add test reset_timer_and_drop
Browse files Browse the repository at this point in the history
  • Loading branch information
wathenjiang committed Jul 24, 2024
1 parent 5f80bbc commit 5554133
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tokio/src/runtime/time/tests/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,28 @@ fn reset_future() {
})
}

#[test]
fn reset_timer_and_drop() {
model(|| {
let rt = rt(false);
let handle = rt.handle();

let start = handle.inner.driver().clock().now();

for _ in 0..2 {
let entry = TimerEntry::new(handle.inner.clone(), start + Duration::from_millis(10));
pin!(entry);

let _ = entry
.as_mut()
.poll_elapsed(&mut Context::from_waker(futures::task::noop_waker_ref()));

entry.as_mut().reset(start + Duration::from_secs(1), true);
drop(entry);
}
});
}

#[cfg(not(loom))]
fn normal_or_miri<T>(normal: T, miri: T) -> T {
if cfg!(miri) {
Expand Down

0 comments on commit 5554133

Please sign in to comment.