1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 11:37:44 +00:00

rm: simplify remove_dir() helper function

This commit is contained in:
Jeffrey Finkelstein 2025-02-16 11:01:38 -05:00
parent 0eab0fa83e
commit 464181bb56
2 changed files with 32 additions and 45 deletions

View file

@ -167,10 +167,11 @@ fn test_rm_non_empty_directory() {
at.mkdir(dir);
at.touch(file_a);
ucmd.arg("-d")
.arg(dir)
.fails()
.stderr_contains(format!("cannot remove '{dir}': Directory not empty"));
#[cfg(windows)]
let expected = "rm: cannot remove 'test_rm_non_empty_dir': The directory is not empty.\n";
#[cfg(not(windows))]
let expected = "rm: cannot remove 'test_rm_non_empty_dir': Directory not empty\n";
ucmd.arg("-d").arg(dir).fails().stderr_only(expected);
assert!(at.file_exists(file_a));
assert!(at.dir_exists(dir));
}