summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHomu <homu@barosl.com>2016-10-25 03:51:49 +0900
committerHomu <homu@barosl.com>2016-10-25 03:51:49 +0900
commite6184859468bacf506730ef9946cc4d09ff65111 (patch)
treefdc58a11df977f893e444d83d374793c5c372a4b
parentbf1e6b2662a4a1b588925eaeaef4cff6d3757942 (diff)
parent40351db00da6ee8c904f47599ee692a85e3d96ef (diff)
downloadnix-e6184859468bacf506730ef9946cc4d09ff65111.zip
Auto merge of #443 - asomers:mkstemp, r=posborne
use tempfile in test_pwrite Use tempfile in test_pwrite so as not to pollute the source directory.
-rw-r--r--test/sys/test_uio.rs7
1 files changed, 2 insertions, 5 deletions
diff --git a/test/sys/test_uio.rs b/test/sys/test_uio.rs
index 27de48be..dda97cde 100644
--- a/test/sys/test_uio.rs
+++ b/test/sys/test_uio.rs
@@ -6,6 +6,7 @@ use std::fs::{OpenOptions, remove_file};
use std::os::unix::io::AsRawFd;
use tempdir::TempDir;
+use tempfile::tempfile;
#[test]
fn test_writev() {
@@ -99,9 +100,7 @@ fn test_readv() {
fn test_pwrite() {
use std::io::Read;
- let path = "pwrite_test_file";
- let mut file = OpenOptions::new().write(true).read(true).create(true)
- .truncate(true).open(path).unwrap();
+ let mut file = tempfile().unwrap();
let buf = [1u8;8];
assert_eq!(Ok(8), pwrite(file.as_raw_fd(), &buf, 8));
let mut file_content = Vec::new();
@@ -109,8 +108,6 @@ fn test_pwrite() {
let mut expected = vec![0u8;8];
expected.extend(vec![1;8]);
assert_eq!(file_content, expected);
-
- remove_file(path).unwrap();
}
#[test]