Sha256: 98d78179d21101c365f15f19fc0690651712438b0997c63eb932b94dd6200eae

Contents?: true

Size: 967 Bytes

Versions: 14

Compression:

Stored size: 967 Bytes

Contents

#![warn(rust_2018_idioms)]
#![cfg(feature = "full")]

use tokio::io::AsyncWriteExt;

#[tokio::test]
async fn sink_poll_write_is_cooperative() {
    tokio::select! {
        biased;
        _ = async {
            loop {
                let buf = vec![1, 2, 3];
                tokio::io::sink().write_all(&buf).await.unwrap();
            }
        } => {},
        _ = tokio::task::yield_now() => {}
    }
}

#[tokio::test]
async fn sink_poll_flush_is_cooperative() {
    tokio::select! {
        biased;
        _ = async {
            loop {
                tokio::io::sink().flush().await.unwrap();
            }
        } => {},
        _ = tokio::task::yield_now() => {}
    }
}

#[tokio::test]
async fn sink_poll_shutdown_is_cooperative() {
    tokio::select! {
        biased;
        _ = async {
            loop {
                tokio::io::sink().shutdown().await.unwrap();
            }
        } => {},
        _ = tokio::task::yield_now() => {}
    }
}

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/tokio-1.43.0/tests/io_sink.rs
wasmtime-28.0.0 ./ext/cargo-vendor/tokio-1.43.0/tests/io_sink.rs
wasmtime-27.0.0 ./ext/cargo-vendor/tokio-1.41.1/tests/io_sink.rs
wasmtime-26.0.0 ./ext/cargo-vendor/tokio-1.41.0/tests/io_sink.rs
wasmtime-25.0.2 ./ext/cargo-vendor/tokio-1.40.0/tests/io_sink.rs
wasmtime-25.0.1 ./ext/cargo-vendor/tokio-1.39.3/tests/io_sink.rs
wasmtime-25.0.0 ./ext/cargo-vendor/tokio-1.39.3/tests/io_sink.rs
wasmtime-24.0.0 ./ext/cargo-vendor/tokio-1.39.3/tests/io_sink.rs
wasmtime-23.0.2 ./ext/cargo-vendor/tokio-1.36.0/tests/io_sink.rs
wasmtime-22.0.0 ./ext/cargo-vendor/tokio-1.36.0/tests/io_sink.rs
wasmtime-21.0.1 ./ext/cargo-vendor/tokio-1.36.0/tests/io_sink.rs
wasmtime-20.0.2 ./ext/cargo-vendor/tokio-1.36.0/tests/io_sink.rs
wasmtime-20.0.0 ./ext/cargo-vendor/tokio-1.36.0/tests/io_sink.rs
wasmtime-18.0.3 ./ext/cargo-vendor/tokio-1.36.0/tests/io_sink.rs