1#![warn(rust_2018_idioms)]
2#![cfg(feature = "full")]
3#![cfg(unix)]
4
5use std::error::Error;
6use tokio::runtime::Builder;
7use tokio::signal::unix::{signal, SignalKind};
8
9mod support {
10 pub mod panic;
11}
12use support::panic::test_panic;
13
14#[test]
15fn signal_panic_caller() -> Result<(), Box<dyn Error>> {
16 let panic_location_file = test_panic(|| {
17 let rt = Builder::new_current_thread().build().unwrap();
18
19 rt.block_on(async {
20 let kind = SignalKind::from_raw(-1);
21 let _ = signal(kind);
22 });
23 });
24
25 // The panic location should be in this file
26 assert_eq!(&panic_location_file.unwrap(), file!());
27
28 Ok(())
29}
30