Sha256: 0e21c7765f526a48d43177d4a731284fd81cd58d73c96f6138cf06502bb6ff3e

Contents?: true

Size: 1.77 KB

Versions: 8

Compression:

Stored size: 1.77 KB

Contents

#![allow(unknown_lints, unexpected_cfgs)]
#![cfg(all(tokio_unstable, feature = "tracing"))]

use std::rc::Rc;
use tokio::{
    task::{Builder, LocalSet},
    test,
};

#[test]
async fn spawn_with_name() {
    let result = Builder::new()
        .name("name")
        .spawn(async { "task executed" })
        .unwrap()
        .await;

    assert_eq!(result.unwrap(), "task executed");
}

#[test]
async fn spawn_blocking_with_name() {
    let result = Builder::new()
        .name("name")
        .spawn_blocking(|| "task executed")
        .unwrap()
        .await;

    assert_eq!(result.unwrap(), "task executed");
}

#[test]
async fn spawn_local_with_name() {
    let unsend_data = Rc::new("task executed");
    let result = LocalSet::new()
        .run_until(async move {
            Builder::new()
                .name("name")
                .spawn_local(async move { unsend_data })
                .unwrap()
                .await
        })
        .await;

    assert_eq!(*result.unwrap(), "task executed");
}

#[test]
async fn spawn_without_name() {
    let result = Builder::new()
        .spawn(async { "task executed" })
        .unwrap()
        .await;

    assert_eq!(result.unwrap(), "task executed");
}

#[test]
async fn spawn_blocking_without_name() {
    let result = Builder::new()
        .spawn_blocking(|| "task executed")
        .unwrap()
        .await;

    assert_eq!(result.unwrap(), "task executed");
}

#[test]
async fn spawn_local_without_name() {
    let unsend_data = Rc::new("task executed");
    let result = LocalSet::new()
        .run_until(async move {
            Builder::new()
                .spawn_local(async move { unsend_data })
                .unwrap()
                .await
        })
        .await;

    assert_eq!(*result.unwrap(), "task executed");
}

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
wasmtime-29.0.0 ./ext/cargo-vendor/tokio-1.43.0/tests/task_builder.rs
wasmtime-28.0.0 ./ext/cargo-vendor/tokio-1.43.0/tests/task_builder.rs
wasmtime-27.0.0 ./ext/cargo-vendor/tokio-1.41.1/tests/task_builder.rs
wasmtime-26.0.0 ./ext/cargo-vendor/tokio-1.41.0/tests/task_builder.rs
wasmtime-25.0.2 ./ext/cargo-vendor/tokio-1.40.0/tests/task_builder.rs
wasmtime-25.0.1 ./ext/cargo-vendor/tokio-1.39.3/tests/task_builder.rs
wasmtime-25.0.0 ./ext/cargo-vendor/tokio-1.39.3/tests/task_builder.rs
wasmtime-24.0.0 ./ext/cargo-vendor/tokio-1.39.3/tests/task_builder.rs