mirror of
https://github.com/tokio-rs/tokio.git
synced 2026-08-27 00:00:12 +02:00
Changes the set of `default` feature flags to `[]`. By default, only core traits are included without specifying feature flags. This makes it easier for users to pick the components they need. For convenience, a `full` feature flag is included that includes all components. Tests are configured to require the `full` feature. Testing individual feature flags will need to be moved to a separate crate. Closes #1791
31 lines
640 B
Rust
31 lines
640 B
Rust
#![warn(rust_2018_idioms)]
|
|
#![cfg(feature = "full")]
|
|
#![cfg(unix)]
|
|
|
|
mod support {
|
|
pub mod signal;
|
|
}
|
|
use support::signal::send_signal;
|
|
|
|
use tokio::signal;
|
|
use tokio::sync::oneshot;
|
|
use tokio_test::assert_ok;
|
|
|
|
#[tokio::test]
|
|
async fn ctrl_c() {
|
|
let ctrl_c = signal::ctrl_c();
|
|
|
|
let (fire, wait) = oneshot::channel();
|
|
|
|
// NB: simulate a signal coming in by exercising our signal handler
|
|
// to avoid complications with sending SIGINT to the test process
|
|
tokio::spawn(async {
|
|
wait.await.expect("wait failed");
|
|
send_signal(libc::SIGINT);
|
|
});
|
|
|
|
let _ = fire.send(());
|
|
|
|
assert_ok!(ctrl_c.await);
|
|
}
|