blob: e46cc63f4599d774fd788debad800235f0187022 [file] [log] [blame]
#[test]
fn spawn() {
assert_eq!(42, smol::run(smol::Task::spawn(async { 42 })));
}
#[test]
fn spawn_detach() {
let (s, r) = piper::chan(1);
smol::Task::spawn(async move { s.send(()).await }).detach();
assert_eq!(Some(()), smol::run(r.recv()));
}
#[test]
fn blocking() {
assert_eq!(42, smol::run(smol::Task::blocking(async { 42 })));
}
#[test]
fn blocking_detach() {
let (s, r) = piper::chan(1);
smol::Task::blocking(async move { s.send(()).await }).detach();
assert_eq!(Some(()), smol::run(r.recv()));
}