1use futures::channel::mpsc;
2use futures::executor::block_on;
3use futures::future::join3;
4use futures::sink::SinkExt;
5use futures::stream::{self, StreamExt};
6
7#[test]
8fn it_works() {
9 let (tx1, rx1) = mpsc::channel(1);
10 let (tx2, rx2) = mpsc::channel(2);
11 let tx = tx1.fanout(tx2).sink_map_err(|_| ());
12
13 let src = stream::iter((0..10).map(Ok));
14 let fwd = src.forward(tx);
15
16 let collect_fut1 = rx1.collect::<Vec<_>>();
17 let collect_fut2 = rx2.collect::<Vec<_>>();
18 let (_, vec1, vec2) = block_on(join3(fwd, collect_fut1, collect_fut2));
19
20 let expected = (0..10).collect::<Vec<_>>();
21
22 assert_eq!(vec1, expected);
23 assert_eq!(vec2, expected);
24}
25