mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-07-24 08:55:47 +00:00
Fix the status-sinks tests, hopefully (#4140)
This commit is contained in:
committed by
Gavin Wood
parent
613b5e7e2d
commit
4e8b68dd14
@@ -113,14 +113,14 @@ mod tests {
|
|||||||
use std::time::Duration;
|
use std::time::Duration;
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn basic_usage() {
|
fn works() {
|
||||||
|
// We're not testing that the `StatusSink` properly enforces an order in the intervals, as
|
||||||
|
// this easily causes test failures on busy CPUs.
|
||||||
|
|
||||||
let mut status_sinks = StatusSinks::new();
|
let mut status_sinks = StatusSinks::new();
|
||||||
|
|
||||||
let (tx1, rx1) = mpsc::unbounded();
|
let (tx, rx) = mpsc::unbounded();
|
||||||
status_sinks.push(Duration::from_millis(200), tx1);
|
status_sinks.push(Duration::from_millis(100), tx);
|
||||||
|
|
||||||
let (tx2, rx2) = mpsc::unbounded();
|
|
||||||
status_sinks.push(Duration::from_millis(500), tx2);
|
|
||||||
|
|
||||||
let mut runtime = tokio::runtime::Runtime::new().unwrap();
|
let mut runtime = tokio::runtime::Runtime::new().unwrap();
|
||||||
|
|
||||||
@@ -130,15 +130,15 @@ mod tests {
|
|||||||
Ok(Async::NotReady)
|
Ok(Async::NotReady)
|
||||||
}));
|
}));
|
||||||
|
|
||||||
let done = rx1
|
let done = rx
|
||||||
.into_future()
|
.into_future()
|
||||||
.and_then(|(item, rest)| {
|
.and_then(|(item, rest)| {
|
||||||
assert_eq!(item, Some(6));
|
assert_eq!(item, Some(6));
|
||||||
rest.into_future()
|
rest.into_future()
|
||||||
})
|
})
|
||||||
.and_then(|(item, _)| {
|
.and_then(|(item, rest)| {
|
||||||
assert_eq!(item, Some(7));
|
assert_eq!(item, Some(7));
|
||||||
rx2.into_future()
|
rest.into_future()
|
||||||
})
|
})
|
||||||
.map(|(item, _)| {
|
.map(|(item, _)| {
|
||||||
assert_eq!(item, Some(8));
|
assert_eq!(item, Some(8));
|
||||||
|
|||||||
Reference in New Issue
Block a user