summaryrefslogtreecommitdiffstats
path: root/third_party/rust/futures/tests/future_inspect.rs
blob: eacd1f78a25d929b93c89b9fe4e289a05ca9f894 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use futures::executor::block_on;
use futures::future::{self, FutureExt};

#[test]
fn smoke() {
    let mut counter = 0;

    {
        let work = future::ready::<i32>(40).inspect(|val| {
            counter += *val;
        });
        assert_eq!(block_on(work), 40);
    }

    assert_eq!(counter, 40);
}