diff options
author | Philipp Keller <philipp.keller@gmail.com> | 2016-09-27 21:45:54 +0200 |
---|---|---|
committer | Philipp Keller <philipp.keller@gmail.com> | 2016-09-27 21:45:54 +0200 |
commit | 700627eae2c5410b5a8aee5151d54e42b9365f73 (patch) | |
tree | a00d12fcc65dabef32161adf8343f2e63cda3954 | |
parent | 95ac98a0b5bcfcbb80b0bd77d0f5c9d8126745cb (diff) | |
download | nix-700627eae2c5410b5a8aee5151d54e42b9365f73.zip |
test also that mkstemp fails when there's no X at the end
-rw-r--r-- | test/test_unistd.rs | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/test/test_unistd.rs b/test/test_unistd.rs index 8b9e6e49..4ff72652 100644 --- a/test/test_unistd.rs +++ b/test/test_unistd.rs @@ -57,14 +57,22 @@ fn test_wait() { #[test] fn test_mkstemp() { - let result = mkstemp("/tmp/nix_tempfile.XXXXXXXX"); + let result = mkstemp("/tmp/nix_tempfile.XXXXXX"); match result { Ok((fd, path)) => { close(fd).unwrap(); unlink(path.as_path()).unwrap(); - } + }, Err(e) => panic!("mkstemp failed: {}", e) } + + let result = mkstemp("/tmp/nix_tempfile"); + match result { + Ok(_) => { + panic!("mkstemp succeeded even though it should fail (no X at the end)"); + }, + Err(_) => {} + } } #[test] |