std: <ExitStatus as Display>::fmt name the signal it died from

This commit is contained in:
Michael Howell 2022-04-08 13:39:24 -07:00
parent 2d5a21f63c
commit 47030d300a
2 changed files with 66 additions and 3 deletions

View file

@ -14,8 +14,8 @@ fn exitstatus_display_tests() {
let t = |v, s| assert_eq!(s, format!("{}", <ExitStatus as ExitStatusExt>::from_raw(v)));
t(0x0000f, "signal: 15");
t(0x0008b, "signal: 11 (core dumped)");
t(0x0000f, "signal: SIGTERM");
t(0x0008b, "signal: SIGSEGV (core dumped)");
t(0x00000, "exit status: 0");
t(0x0ff00, "exit status: 255");
@ -24,7 +24,7 @@ fn exitstatus_display_tests() {
// The purpose of this test is to test our string formatting, not our understanding of the wait
// status magic numbers. So restrict these to Linux.
if cfg!(target_os = "linux") {
t(0x0137f, "stopped (not terminated) by signal: 19");
t(0x0137f, "stopped (not terminated) by signal: SIGSTOP");
t(0x0ffff, "continued (WIFCONTINUED)");
}