summaryrefslogtreecommitdiff
path: root/test/sys
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2017-12-09 18:09:47 +0000
committerbors[bot] <bors[bot]@users.noreply.github.com>2017-12-09 18:09:47 +0000
commite1ce3619bd3013d345a36d0a7b908c243788471e (patch)
tree319b77ac9b04f1d1c34f329aff86cdca914ba72c /test/sys
parente5cc9152452db25bd0d30e1b0fe19e8733a59c2e (diff)
parent996bc6b76a4830dfb0a1f28ee62f5d8b17febbac (diff)
downloadnix-e1ce3619bd3013d345a36d0a7b908c243788471e.zip
Merge #741
741: Expose `decode` on `WaitStatus` and make it return a `Result` r=Susurrus a=rocallahan Closes #740.
Diffstat (limited to 'test/sys')
-rw-r--r--test/sys/test_wait.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/test/sys/test_wait.rs b/test/sys/test_wait.rs
index 44a111a3..02f32734 100644
--- a/test/sys/test_wait.rs
+++ b/test/sys/test_wait.rs
@@ -1,3 +1,4 @@
+use nix::Error;
use nix::unistd::*;
use nix::unistd::ForkResult::*;
use nix::sys::signal::*;
@@ -38,6 +39,14 @@ fn test_wait_exit() {
}
#[test]
+fn test_waitstatus_from_raw() {
+ let pid = Pid::from_raw(1);
+ assert_eq!(WaitStatus::from_raw(pid, 0x0002), Ok(WaitStatus::Signaled(pid, Signal::SIGINT, false)));
+ assert_eq!(WaitStatus::from_raw(pid, 0x0200), Ok(WaitStatus::Exited(pid, 2)));
+ assert_eq!(WaitStatus::from_raw(pid, 0x7f7f), Err(Error::invalid_argument()));
+}
+
+#[test]
fn test_waitstatus_pid() {
let _m = ::FORK_MTX.lock().expect("Mutex got poisoned by another test");