1 | #![warn(rust_2018_idioms)] |
---|---|
2 | #![cfg(feature = "full")] |
3 | #![cfg(unix)] |
4 | |
5 | mod support { |
6 | pub mod signal; |
7 | } |
8 | use support::signal::send_signal; |
9 | |
10 | use tokio::signal::unix::{signal, SignalKind}; |
11 | |
12 | #[tokio::test] |
13 | async fn twice() { |
14 | let kind = SignalKind::user_defined1(); |
15 | let mut sig = signal(kind).expect("failed to get signal"); |
16 | |
17 | for _ in 0..2 { |
18 | send_signal(libc::SIGUSR1); |
19 | |
20 | assert!(sig.recv().await.is_some()); |
21 | } |
22 | } |
23 |