mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 11:37:44 +00:00
Merge pull request #5762 from cakebaker/cp_link_same_file
cp: show no "same file" error for `--link a a`
This commit is contained in:
commit
e3beda08ac
2 changed files with 18 additions and 0 deletions
|
@ -566,6 +566,22 @@ fn test_cp_arg_link_with_dest_hardlink_to_source() {
|
|||
assert!(at.file_exists(hardlink));
|
||||
}
|
||||
|
||||
#[test]
|
||||
#[cfg(target_os = "linux")]
|
||||
fn test_cp_arg_link_with_same_file() {
|
||||
use std::os::linux::fs::MetadataExt;
|
||||
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
let file = "file";
|
||||
|
||||
at.touch(file);
|
||||
|
||||
ucmd.args(&["--link", file, file]).succeeds();
|
||||
|
||||
assert_eq!(at.metadata(file).st_nlink(), 1);
|
||||
assert!(at.file_exists(file));
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_cp_arg_symlink() {
|
||||
let (at, mut ucmd) = at_and_ucmd!();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue