Skip to content

Commit

Permalink
Move rename_directory from ui-fulldeps to std
Browse files Browse the repository at this point in the history
std has had a `TempDir` implementation for a long time now.
  • Loading branch information
ChrisDenton committed Feb 21, 2023
1 parent 6a92395 commit f7a132f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 30 deletions.
16 changes: 16 additions & 0 deletions library/std/src/fs/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1595,3 +1595,19 @@ fn test_read_dir_infinite_loop() {
// Check for duplicate errors
assert!(dir.filter(|e| e.is_err()).take(2).count() < 2);
}

#[test]
fn rename_directory() {
let tmpdir = tmpdir();
let old_path = tmpdir.join("foo/bar/baz");
fs::create_dir_all(&old_path).unwrap();
let test_file = &old_path.join("temp.txt");

File::create(test_file).unwrap();

let new_path = tmpdir.join("quux/blat");
fs::create_dir_all(&new_path).unwrap();
fs::rename(&old_path, &new_path.join("newdir")).unwrap();
assert!(new_path.join("newdir").is_dir());
assert!(new_path.join("newdir/temp.txt").exists());
}
30 changes: 0 additions & 30 deletions tests/ui-fulldeps/std/rename-directory.rs

This file was deleted.

0 comments on commit f7a132f

Please sign in to comment.