1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-16 19:56:17 +00:00

Merge pull request #2597 from miDeb/resolve-dangling

uucore/fs: use the latest resolution that did not fail
This commit is contained in:
Sylvestre Ledru 2021-08-28 09:55:44 +02:00 committed by GitHub
commit 33055f7152
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 52 additions and 18 deletions

View file

@ -139,3 +139,23 @@ fn test_realpath_logical_mode() {
.succeeds()
.stdout_contains("dir1\n");
}
#[test]
fn test_realpath_dangling() {
let (at, mut ucmd) = at_and_ucmd!();
at.symlink_file("nonexistent-file", "link");
ucmd.arg("link")
.succeeds()
.stdout_only(at.plus_as_string("nonexistent-file\n"));
}
#[test]
fn test_realpath_loop() {
let (at, mut ucmd) = at_and_ucmd!();
at.symlink_file("2", "1");
at.symlink_file("3", "2");
at.symlink_file("1", "3");
ucmd.arg("1")
.succeeds()
.stdout_only(at.plus_as_string("2\n"));
}