summaryrefslogtreecommitdiffstats
path: root/tokio/src/time/tests/mod.rs
blob: a043d65e19d5e4d8482caa6711490e1206b5ef7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
mod test_delay;

use crate::time::{self, Instant};
use std::time::Duration;

fn assert_send<T: Send>() {}
fn assert_sync<T: Sync>() {}

#[test]
fn registration_is_send_and_sync() {
    use crate::time::delay::Delay;

    assert_send::<Delay>();
    assert_sync::<Delay>();
}

#[test]
#[should_panic]
fn delay_is_eager() {
    let when = Instant::now() + Duration::from_millis(100);
    let _ = time::sleep_until(when);
}