1use async_stream::stream;
2
3use futures_util::stream::StreamExt;
4
5#[tokio::test]
6async fn test() {
7 let s = stream! {
8 yield "hello";
9 yield "world";
10 };
11
12 let s = stream! {
13 for await x in s {
14 yield x.to_owned() + "!";
15 }
16 };
17
18 let values: Vec<_> = s.collect().await;
19
20 assert_eq!(2, values.len());
21 assert_eq!("hello!", values[0]);
22 assert_eq!("world!", values[1]);
23}
24