mirror of
https://github.com/uutils/coreutils.git
synced 2025-12-23 08:47:37 +00:00
Merge pull request #9623 from ChrisDryden/cp_coverage
cp: Adding test to cover no dereference when copying symlinks
This commit is contained in:
commit
47045a2011
1 changed files with 19 additions and 0 deletions
|
|
@ -7118,6 +7118,25 @@ fn test_cp_no_dereference_symlink_with_parents() {
|
|||
assert_eq!(at.resolve_link("x/symlink-to-directory"), "directory");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_cp_recursive_no_dereference_symlink_to_directory() {
|
||||
let ts = TestScenario::new(util_name!());
|
||||
let at = &ts.fixtures;
|
||||
|
||||
at.mkdir("source_dir");
|
||||
at.touch("source_dir/file.txt");
|
||||
at.symlink_file("source_dir", "symlink_to_dir");
|
||||
|
||||
// Copy with -r --no-dereference (or -rP): should copy the symlink, not the directory contents
|
||||
ts.ucmd()
|
||||
.args(&["-r", "--no-dereference", "symlink_to_dir", "dest"])
|
||||
.succeeds();
|
||||
|
||||
assert!(at.is_symlink("dest"));
|
||||
assert_eq!(at.resolve_link("dest"), "source_dir");
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(unix)]
|
||||
fn test_cp_recursive_files_ending_in_backslash() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue