This commit is contained in:
Stjepan Glavina 2020-08-15 08:16:22 +02:00
parent d183433d9e
commit 453d2b2d5e
1 changed files with 17 additions and 0 deletions

17
tests/timeout.rs Normal file
View File

@ -0,0 +1,17 @@
use std::io;
use std::time::{Duration, Instant};
use polling::Poller;
#[test]
fn timeout() -> io::Result<()> {
let poller = Poller::new()?;
let mut events = Vec::new();
let start = Instant::now();
poller.wait(&mut events, Some(Duration::from_secs(2)))?;
let elapsed = start.elapsed();
assert!(elapsed >= Duration::from_secs(2));
Ok(())
}