aboutsummaryrefslogtreecommitdiff
path: root/tests/rt_time_start_paused.rs
blob: 283f4748a8a8377348a18aec5ca6a0e0b1b13164 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
#![cfg(all(feature = "full"))]

use tokio::time::{Duration, Instant};

#[tokio::test(start_paused = true)]
async fn test_start_paused() {
    let now = Instant::now();

    // Pause a few times w/ std sleep and ensure `now` stays the same
    for _ in 0..5 {
        std::thread::sleep(Duration::from_millis(1));
        assert_eq!(now, Instant::now());
    }
}