diff options
Diffstat (limited to 'test/test_unistd.rs')
-rw-r--r-- | test/test_unistd.rs | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/test_unistd.rs b/test/test_unistd.rs index 50af197c..055c0c1a 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -30,6 +30,23 @@ fn test_fork_and_waitpid() { } #[test] +fn test_wait() { + let pid = fork(); + match pid { + Ok(Child) => {} // ignore child here + Ok(Parent(child_pid)) => { + let wait_status = wait(); + + // just assert that (any) one child returns with WaitStatus::Exited + assert_eq!(wait_status, Ok(WaitStatus::Exited(child_pid))); + }, + // panic, fork should never fail unless there is a serious problem with the OS + Err(_) => panic!("Error: Fork Failed") + } +} + + +#[test] fn test_getpid() { let pid = getpid(); let ppid = getppid(); |