From 32765ece418f81b2e36f9f2ca73a60ea0b893531 Mon Sep 17 00:00:00 2001 From: k-nasa Date: Wed, 27 Nov 2019 14:26:25 +0900 Subject: [PATCH] test: Add stream::delay test code --- src/stream/stream/mod.rs | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/stream/stream/mod.rs b/src/stream/stream/mod.rs index ef1e5ec..e847d6a 100644 --- a/src/stream/stream/mod.rs +++ b/src/stream/stream/mod.rs @@ -587,16 +587,12 @@ extension_trait! { use async_std::stream; use std::time::Duration; - let a = stream::once(1).delay(Duration::from_millis(200)); - let b = stream::once(2).delay(Duration::from_millis(100)); - let c = stream::once(3).delay(Duration::from_millis(300)); + let mut s = stream::from_iter(vec![0u8, 1, 2]).delay(Duration::from_millis(200)); - let s = stream::join!(a, b, c); - - assert_eq!(stream.next().await, Some(1)); - assert_eq!(stream.next().await, Some(2)); - assert_eq!(stream.next().await, Some(3)); - assert_eq!(stream.next().await, None); + assert_eq!(s.next().await, Some(0)); + assert_eq!(s.next().await, Some(1)); + assert_eq!(s.next().await, Some(2)); + assert_eq!(s.next().await, None); # # }) } ```