mirror of
https://github.com/sigp/lighthouse.git
synced 2026-07-04 05:14:33 +00:00
Adds panic test to hashset delay
This commit is contained in:
@@ -7,3 +7,6 @@ edition = "2018"
|
|||||||
[dependencies]
|
[dependencies]
|
||||||
futures = "0.3.4"
|
futures = "0.3.4"
|
||||||
tokio = { version = "0.2.19", features = ["time"] }
|
tokio = { version = "0.2.19", features = ["time"] }
|
||||||
|
|
||||||
|
[dev-dependencies]
|
||||||
|
tokio = { version = "0.2.19", features = ["time", "rt-threaded", "macros"] }
|
||||||
|
|||||||
@@ -163,3 +163,30 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[cfg(test)]
|
||||||
|
|
||||||
|
mod tests {
|
||||||
|
use super::*;
|
||||||
|
|
||||||
|
#[tokio::test]
|
||||||
|
async fn should_not_panic() {
|
||||||
|
let key = 2u8;
|
||||||
|
|
||||||
|
let mut map = HashSetDelay::default();
|
||||||
|
|
||||||
|
map.insert(key);
|
||||||
|
map.update_timeout(&key, Duration::from_secs(100));
|
||||||
|
|
||||||
|
let fut = |cx: &mut Context| {
|
||||||
|
let _ = map.poll_next_unpin(cx);
|
||||||
|
let _ = map.poll_next_unpin(cx);
|
||||||
|
Poll::Ready(())
|
||||||
|
};
|
||||||
|
|
||||||
|
future::poll_fn(fut).await;
|
||||||
|
|
||||||
|
map.insert(key);
|
||||||
|
map.update_timeout(&key, Duration::from_secs(100));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user