Files
tokio/tokio-executor/tests/executor.rs
T

26 lines
543 B
Rust
Raw Normal View History

2019-05-14 10:27:36 -07:00
#![deny(warnings, rust_2018_idioms)]
2019-06-24 12:34:30 -07:00
#![feature(await_macro, async_await)]
2019-05-14 10:27:36 -07:00
use tokio_executor::{self, DefaultExecutor};
2019-06-24 12:34:30 -07:00
use std::future::Future;
use std::pin::Pin;
mod out_of_executor_context {
use super::*;
2019-03-21 14:30:18 -07:00
use tokio_executor::Executor;
fn test<F, E>(spawn: F)
where
2019-06-24 12:34:30 -07:00
F: Fn(Pin<Box<dyn Future<Output = ()> + Send>>) -> Result<(), E>,
{
2019-06-24 12:34:30 -07:00
let res = spawn(Box::pin(async {}));
assert!(res.is_err());
}
#[test]
fn spawn() {
test(|f| DefaultExecutor::current().spawn(f));
}
}