1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-26 19:47:43 +02:00

system: run and return exit code on stop (#411)

Co-authored-by: Rob Ede <robjtede@icloud.com>
This commit is contained in:
Luca Bruno
2021-11-15 18:49:02 +00:00
committed by GitHub
parent ae28ce5377
commit ce8ec15eaa
3 changed files with 38 additions and 19 deletions

View File

@ -24,6 +24,15 @@ fn await_for_timer() {
);
}
#[cfg(not(feature = "io-uring"))]
#[test]
fn run_with_code() {
let sys = System::new();
System::current().stop_with_code(42);
let exit_code = sys.run_with_code().expect("system stop should not error");
assert_eq!(exit_code, 42);
}
#[test]
fn join_another_arbiter() {
let time = Duration::from_secs(1);
@ -99,8 +108,8 @@ fn wait_for_spawns() {
let handle = rt.spawn(async {
println!("running on the runtime");
// assertion panic is caught at task boundary
assert_eq!(1, 2);
// panic is caught at task boundary
panic!("intentional test panic");
});
assert!(rt.block_on(handle).is_err());