From 70c451fa61cb342b8a4646c4ad053ebe1ec0f608 Mon Sep 17 00:00:00 2001 From: anastygnome Date: Mon, 2 May 2022 08:20:46 +0200 Subject: [PATCH] Add test for copying dangling symlink copy with dereference Signed-off-by: anastygnome --- tests/by-util/test_cp.rs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index 079e966be..cdcaf2760 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -1506,6 +1506,18 @@ fn test_copy_through_dangling_symlink() { .stderr_only("cp: not writing through dangling symlink 'target'"); } +#[test] +fn test_copy_through_dangling_symlink_no_dereference() { + let (at, mut ucmd) = at_and_ucmd!(); + at.symlink_file("no-such-file", "dangle"); + ucmd.arg("-P") + .arg("dangle") + .arg("d2") + .succeeds() + .no_stderr() + .no_stdout(); +} + #[test] #[cfg(unix)] fn test_cp_archive_on_nonexistent_file() {