cp: add a test for #2631

This commit is contained in:
Michael Debertol 2021-09-03 14:56:35 +02:00
parent ef9c5d4fcf
commit 6a6da71403

View file

@ -7,6 +7,8 @@ use std::fs::set_permissions;
#[cfg(not(windows))]
use std::os::unix::fs;
#[cfg(unix)]
use std::os::unix::fs::symlink as symlink_file;
#[cfg(unix)]
use std::os::unix::fs::PermissionsExt;
#[cfg(windows)]
@ -1353,3 +1355,16 @@ fn test_preserve_mode() {
PERMS_ALL
);
}
#[test]
fn test_canonicalize_symlink() {
let (at, mut ucmd) = at_and_ucmd!();
at.mkdir("dir");
at.touch("dir/file");
symlink_file("../dir/file", at.plus("dir/file-ln")).unwrap();
ucmd.arg("dir/file-ln")
.arg(".")
.succeeds()
.no_stderr()
.no_stdout();
}