From bc22c19231be8b7a8d5b1bf5488b08e079164acc Mon Sep 17 00:00:00 2001 From: M Bussonnier Date: Sat, 15 Mar 2025 17:37:28 +0100 Subject: [PATCH 1/2] Create failing test for #7455 Also update existing test to ensure output is empty. --- tests/by-util/test_cp.rs | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 646d6e53551..a86b0fd526e 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -349,13 +349,39 @@ fn test_cp_arg_no_target_directory_with_recursive() { at.touch("dir/a"); at.touch("dir/b"); - ucmd.arg("-rT").arg("dir").arg("dir2").succeeds(); + ucmd.arg("-rT") + .arg("dir") + .arg("dir2") + .succeeds() + .no_output(); assert!(at.plus("dir2").join("a").exists()); assert!(at.plus("dir2").join("b").exists()); assert!(!at.plus("dir2").join("dir").exists()); } +#[test] +fn test_cp_arg_no_target_directory_with_recursive_target_does_not_exists() { + let (at, mut ucmd) = at_and_ucmd!(); + + at.mkdir("dir"); + at.touch("dir/a"); + at.touch("dir/b"); + + let target = "create_me"; + assert!(!at.plus(target).exists()); + + ucmd.arg("-rT") + .arg("dir") + .arg(target) + .succeeds() + .no_output(); + + assert!(at.plus(target).join("a").exists()); + assert!(at.plus(target).join("b").exists()); + assert!(!at.plus(target).join("dir").exists()); +} + #[test] fn test_cp_target_directory_is_file() { new_ucmd!() From 68bb8a2871f89c1924faabd1967d18493e266e47 Mon Sep 17 00:00:00 2001 From: M Bussonnier Date: Sun, 16 Mar 2025 15:01:05 +0100 Subject: [PATCH 2/2] add ignore until relevant issue is fixed --- tests/by-util/test_cp.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index a86b0fd526e..17a0372bf95 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -361,6 +361,7 @@ fn test_cp_arg_no_target_directory_with_recursive() { } #[test] +#[ignore = "disabled until https://github.com/uutils/coreutils/issues/7455 is fixed"] fn test_cp_arg_no_target_directory_with_recursive_target_does_not_exists() { let (at, mut ucmd) = at_and_ucmd!();