summaryrefslogtreecommitdiffstats
path: root/third_party/rust/tokio-stream/tests/stream_pending.rs
blob: 87b5d03bda25965d12e3d12d2de0a727bb3b314a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use tokio_stream::{self as stream, Stream, StreamExt};
use tokio_test::{assert_pending, task};

#[tokio::test]
async fn basic_usage() {
    let mut stream = stream::pending::<i32>();

    for _ in 0..2 {
        assert_eq!(stream.size_hint(), (0, None));

        let mut next = task::spawn(async { stream.next().await });
        assert_pending!(next.poll());
    }
}