Skip to content

Commit f7a132f

Browse files
committed
Move rename_directory from ui-fulldeps to std
std has had a `TempDir` implementation for a long time now.
1 parent 6a92395 commit f7a132f

File tree

2 files changed

+16
-30
lines changed

2 files changed

+16
-30
lines changed

library/std/src/fs/tests.rs

+16
Original file line numberDiff line numberDiff line change
@@ -1595,3 +1595,19 @@ fn test_read_dir_infinite_loop() {
15951595
// Check for duplicate errors
15961596
assert!(dir.filter(|e| e.is_err()).take(2).count() < 2);
15971597
}
1598+
1599+
#[test]
1600+
fn rename_directory() {
1601+
let tmpdir = tmpdir();
1602+
let old_path = tmpdir.join("foo/bar/baz");
1603+
fs::create_dir_all(&old_path).unwrap();
1604+
let test_file = &old_path.join("temp.txt");
1605+
1606+
File::create(test_file).unwrap();
1607+
1608+
let new_path = tmpdir.join("quux/blat");
1609+
fs::create_dir_all(&new_path).unwrap();
1610+
fs::rename(&old_path, &new_path.join("newdir")).unwrap();
1611+
assert!(new_path.join("newdir").is_dir());
1612+
assert!(new_path.join("newdir/temp.txt").exists());
1613+
}

tests/ui-fulldeps/std/rename-directory.rs

-30
This file was deleted.

0 commit comments

Comments
 (0)