1 #![warn(rust_2018_idioms)] 2 #![cfg(feature = "full")] 3 #![cfg(unix)] 4 5 use std::error::Error; 6 use tokio::runtime::Builder; 7 use tokio::signal::unix::{signal, SignalKind}; 8 9 mod support { 10 pub mod panic; 11 } 12 use support::panic::test_panic; 13 14 #[test] signal_panic_caller() -> Result<(), Box<dyn Error>>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