Skip to content

Commit

Permalink
tests/ln: add test for same file
Browse files Browse the repository at this point in the history
  • Loading branch information
niyaznigmatullin committed Jul 18, 2022
1 parent 4db0827 commit 0ab0f27
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/by-util/test_ln.rs
Original file line number Diff line number Diff line change
Expand Up @@ -702,3 +702,16 @@ fn test_hard_logical_dir_fail() {
.fails()
.stderr_contains("failed to link 'link-to-dir'");
}

#[test]
fn test_symlink_remove_existing_same_src_and_dest() {
let (at, mut ucmd) = at_and_ucmd!();
at.touch("a");
at.write("a", "sample");
ucmd.args(&["-sf", "a", "a"])
.fails()
.code_is(1)
.stderr_contains("Same file");
assert!(at.file_exists("a") && !at.symlink_exists("a"));
assert_eq!(at.read("a"), "sample");
}

0 comments on commit 0ab0f27

Please sign in to comment.