From 59da0d8cd685150b32f91e1010e5096156443a6a Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Sun, 19 Dec 2021 18:19:48 +0100 Subject: [PATCH] cp: add a unit test for issue 1665 --- tests/by-util/test_cp.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tests/by-util/test_cp.rs b/tests/by-util/test_cp.rs index fc9dd589c..65d89b163 100644 --- a/tests/by-util/test_cp.rs +++ b/tests/by-util/test_cp.rs @@ -731,6 +731,15 @@ fn test_cp_writable_special_file_permissions() { new_ucmd!().arg("/dev/null").arg("/dev/zero").succeeds(); } +#[test] +#[cfg(unix)] +fn test_cp_issue_1665() { + let (at, mut ucmd) = at_and_ucmd!(); + ucmd.arg("/dev/null").arg("foo").succeeds(); + assert!(at.file_exists("foo")); + assert_eq!(at.read("foo"), ""); +} + #[test] fn test_cp_preserve_no_args() { new_ucmd!()