about summary refs log tree commit diff
path: root/src/libstd/fs.rs
diff options
context:
space:
mode:
authorSteven Fackler <sfackler@gmail.com>2016-03-16 20:50:45 -0700
committerSteven Fackler <sfackler@gmail.com>2016-03-20 18:57:58 -0700
commitc0d989ed6b4b840a290a80ec0cdbc8edbce2ee57 (patch)
treeaf07033b95415a5b27a5717fe4d9e2f3e3463d9d /src/libstd/fs.rs
parent173676efdc8a9f1f2a86d37c08a104e2e505f9e4 (diff)
downloadrust-c0d989ed6b4b840a290a80ec0cdbc8edbce2ee57.tar.gz
rust-c0d989ed6b4b840a290a80ec0cdbc8edbce2ee57.zip
Add unix socket support to the standard library
Diffstat (limited to 'src/libstd/fs.rs')
-rw-r--r--src/libstd/fs.rs37
1 files changed, 3 insertions, 34 deletions
diff --git a/src/libstd/fs.rs b/src/libstd/fs.rs
index b98344b01a7..96534f817f8 100644
--- a/src/libstd/fs.rs
+++ b/src/libstd/fs.rs
@@ -1457,12 +1457,12 @@ mod tests {
     use prelude::v1::*;
     use io::prelude::*;
 
-    use env;
     use fs::{self, File, OpenOptions};
     use io::{ErrorKind, SeekFrom};
-    use path::{Path, PathBuf};
-    use rand::{self, StdRng, Rng};
+    use path::Path;
+    use rand::{StdRng, Rng};
     use str;
+    use sys_common::io::test::{TempDir, tmpdir};
 
     #[cfg(windows)]
     use os::windows::fs::{symlink_dir, symlink_file};
@@ -1490,37 +1490,6 @@ mod tests {
         }
     ) }
 
-    pub struct TempDir(PathBuf);
-
-    impl TempDir {
-        fn join(&self, path: &str) -> PathBuf {
-            let TempDir(ref p) = *self;
-            p.join(path)
-        }
-
-        fn path<'a>(&'a self) -> &'a Path {
-            let TempDir(ref p) = *self;
-            p
-        }
-    }
-
-    impl Drop for TempDir {
-        fn drop(&mut self) {
-            // Gee, seeing how we're testing the fs module I sure hope that we
-            // at least implement this correctly!
-            let TempDir(ref p) = *self;
-            check!(fs::remove_dir_all(p));
-        }
-    }
-
-    pub fn tmpdir() -> TempDir {
-        let p = env::temp_dir();
-        let mut r = rand::thread_rng();
-        let ret = p.join(&format!("rust-{}", r.next_u32()));
-        check!(fs::create_dir(&ret));
-        TempDir(ret)
-    }
-
     // Several test fail on windows if the user does not have permission to
     // create symlinks (the `SeCreateSymbolicLinkPrivilege`). Instead of
     // disabling these test on Windows, use this function to test whether we