From 7a9128197621e0faf75e8f7c095b8f197d01c0ff Mon Sep 17 00:00:00 2001 From: Dominik Bittner Date: Sat, 20 Mar 2021 13:49:53 +0100 Subject: [PATCH] Install: remove path when copining files - add a test for copying a file from one directory to another - add the desired behavior Fixes #1823 --- tests/by-util/test_install.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/tests/by-util/test_install.rs b/tests/by-util/test_install.rs index 7b3706f9e..9f4d9af18 100644 --- a/tests/by-util/test_install.rs +++ b/tests/by-util/test_install.rs @@ -358,3 +358,18 @@ fn test_install_target_file_dev_null() { ucmd.arg(file1).arg(file2).succeeds().no_stderr(); assert!(at.file_exists(file2)); } + +#[test] +fn test_install_copy_file_leading_dot() { + let (at, mut ucmd) = at_and_ucmd!(); + let dir1 = "test_install_target_new_file_dir_l"; + let dir2 = "test_install_target_new_file_dir_m"; + let file1 = "test_install_target_file_file_l1"; + + at.mkdir(dir1); + at.mkdir(dir2); + at.touch(&format!("{}/{}", dir1, file1)); + + ucmd.arg(format!("{}/{}", dir1, file1)).arg(dir2).succeeds().no_stderr(); + assert!(at.file_exists(&format!("{}/{}", dir2, file1))); +}