diff options
| author | Steven Fackler <sfackler@gmail.com> | 2016-03-16 20:50:45 -0700 |
|---|---|---|
| committer | Steven Fackler <sfackler@gmail.com> | 2016-03-20 18:57:58 -0700 |
| commit | c0d989ed6b4b840a290a80ec0cdbc8edbce2ee57 (patch) | |
| tree | af07033b95415a5b27a5717fe4d9e2f3e3463d9d /src/libstd/fs.rs | |
| parent | 173676efdc8a9f1f2a86d37c08a104e2e505f9e4 (diff) | |
| download | rust-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.rs | 37 |
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 |
