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

mv: fix issue with -T and dest ending with "/"

This commit is contained in:
Daniel Hofstetter 2023-11-19 15:10:28 +01:00
parent eb00c195c6
commit 8e796d3bb6
2 changed files with 27 additions and 1 deletions

View file

@ -1158,6 +1158,32 @@ fn test_mv_overwrite_dir() {
assert!(at.dir_exists(dir_b));
}
#[test]
fn test_mv_no_target_dir_with_dest_not_existing() {
let (at, mut ucmd) = at_and_ucmd!();
let dir_a = "a";
let dir_b = "b";
at.mkdir(dir_a);
ucmd.arg("-T").arg(dir_a).arg(dir_b).succeeds().no_output();
assert!(!at.dir_exists(dir_a));
assert!(at.dir_exists(dir_b));
}
#[test]
fn test_mv_no_target_dir_with_dest_not_existing_and_ending_with_slash() {
let (at, mut ucmd) = at_and_ucmd!();
let dir_a = "a";
let dir_b = "b/";
at.mkdir(dir_a);
ucmd.arg("-T").arg(dir_a).arg(dir_b).succeeds().no_output();
assert!(!at.dir_exists(dir_a));
assert!(at.dir_exists(dir_b));
}
#[test]
fn test_mv_overwrite_nonempty_dir() {
let (at, mut ucmd) = at_and_ucmd!();