mirror of
https://github.com/rust-lang/cargo.git
synced 2025-09-28 11:20:36 +00:00
test: add a test case for removing symlink dir
Signed-off-by: hi-rustin <rustin.liu@gmail.com>
This commit is contained in:
parent
84dc5dc11a
commit
8b0161ede4
@ -908,4 +908,27 @@ mod tests {
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(windows)]
|
||||
fn test_remove_symlink_dir() {
|
||||
use super::*;
|
||||
use std::fs;
|
||||
use std::os::windows::fs::symlink_dir;
|
||||
|
||||
let tmpdir = tempfile::tempdir().unwrap();
|
||||
let dir_path = tmpdir.path().join("testdir");
|
||||
let symlink_path = tmpdir.path().join("symlink");
|
||||
|
||||
fs::create_dir(&dir_path).unwrap();
|
||||
|
||||
symlink_dir(&dir_path, &symlink_path).expect("failed to create symlink");
|
||||
|
||||
assert!(symlink_path.exists());
|
||||
|
||||
assert!(remove_file(symlink_path.clone()).is_err());
|
||||
|
||||
assert!(symlink_path.exists());
|
||||
assert!(dir_path.exists());
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user