1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-07-28 19:47:45 +00:00

rm: add verbose output and trim multiple slashes (#1988)

* rm: add verbose output and trim multiple slashes

Uses the normalize_path used in cargo to strip duplicate slashes
With a link to a std rfc https://github.com/rust-lang/rfcs/issues/2208

This fixes https://github.com/uutils/coreutils/issues/1829

This also touches https://github.com/uutils/coreutils/issues/1768 
but does not attempt to fully solve it
This commit is contained in:
Marvin Hofmann 2021-04-05 21:18:47 +01:00 committed by GitHub
parent 8ee4055a9f
commit 9581fcf688
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 133 additions and 5 deletions

View file

@ -263,3 +263,32 @@ fn test_rm_no_operand() {
ucmd.fails()
.stderr_is("rm: error: missing an argument\nrm: error: for help, try 'rm --help'\n");
}
#[test]
fn test_rm_verbose_slash() {
let (at, mut ucmd) = at_and_ucmd!();
let dir = "test_rm_verbose_slash_directory";
let file_a = &format!("{}/test_rm_verbose_slash_file_a", dir);
at.mkdir(dir);
at.touch(file_a);
let file_a_normalized = &format!(
"{}{}test_rm_verbose_slash_file_a",
dir,
std::path::MAIN_SEPARATOR
);
ucmd.arg("-r")
.arg("-f")
.arg("-v")
.arg(&format!("{}///", dir))
.succeeds()
.stdout_only(format!(
"removed '{}'\nremoved directory '{}'\n",
file_a_normalized, dir
));
assert!(!at.dir_exists(dir));
assert!(!at.file_exists(file_a));
}