Vendor dependencies
Let's see how I like this workflow.
This commit is contained in:
parent
34d1830413
commit
9c435dc440
7500 changed files with 1665121 additions and 99 deletions
30
vendor/tokio/tests/signal_ctrl_c.rs
vendored
Normal file
30
vendor/tokio/tests/signal_ctrl_c.rs
vendored
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
#![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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue