#![cfg(feature = "multi-thread")]
use async_compat::CompatExt;
#[test]
fn block_in_place_works_in_a_task_spawned_from_compat() {
let answer = futures::executor::block_on(
async {
tokio::spawn(async { tokio::task::block_in_place(|| 42) })
.await
.expect("spawned task panicked")
}
.compat(),
);
assert_eq!(answer, 42);
}
#[test]
fn fallback_runtime_is_multi_threaded() {
let flavor = futures::executor::block_on(
async { tokio::runtime::Handle::current().runtime_flavor() }.compat(),
);
assert_eq!(flavor, tokio::runtime::RuntimeFlavor::MultiThread);
}