diff options
author | Jakub Pastuszek <jpastuszek@gmail.com> | 2017-10-11 09:46:22 +0100 |
---|---|---|
committer | Jakub Pastuszek <jpastuszek@gmail.com> | 2017-10-11 09:46:22 +0100 |
commit | 08c41c853b092f20cad6f3a3ff9153b3b34564f2 (patch) | |
tree | 89cb1c8550b6898a6317d41ca9538cf39f507a7e /test | |
parent | bd7d2b13f86a29369d9cdb21f171369b4a8d9b98 (diff) | |
download | nix-08c41c853b092f20cad6f3a3ff9153b3b34564f2.zip |
added unistd::mkfifo #602
Diffstat (limited to 'test')
-rw-r--r-- | test/test_unistd.rs | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/test_unistd.rs b/test/test_unistd.rs index adf73579..627eb09b 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -86,6 +86,24 @@ fn test_mkstemp_directory() { } #[test] +fn test_mkfifo() { + let tempdir = TempDir::new("nix-test_mkfifo").unwrap(); + let mkfifo_fifo = tempdir.path().join("mkfifo_fifo"); + + mkfifo(&mkfifo_fifo, stat::S_IRUSR).unwrap(); + + let stats = stat::stat(&mkfifo_fifo).unwrap(); + let typ = stat::SFlag::from_bits_truncate(stats.st_mode); + assert!(typ == stat::S_IFIFO); +} + +#[test] +fn test_mkfifo_directory() { + // mkfifo should fail if a directory is given + assert!(mkfifo(&env::temp_dir(), stat::S_IRUSR).is_err()); +} + +#[test] fn test_getpid() { let pid: ::libc::pid_t = getpid().into(); let ppid: ::libc::pid_t = getppid().into(); |