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:
parent
8ee4055a9f
commit
9581fcf688
4 changed files with 133 additions and 5 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue