mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
Add Physical mode to realpath
This adds the 'Physical Mode' and 'Logical Mode' switches to realpath, which control when symlinks are resolved.
This commit is contained in:
parent
c98e7f5de9
commit
0e04f959c2
8 changed files with 153 additions and 45 deletions
|
@ -106,3 +106,36 @@ fn test_realpath_file_and_links_strip_zero() {
|
|||
.succeeds()
|
||||
.stdout_contains("bar\u{0}");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_realpath_physical_mode() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
|
||||
at.mkdir("dir1");
|
||||
at.mkdir_all("dir2/bar");
|
||||
at.symlink_dir("dir2/bar", "dir1/foo");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("dir1/foo/..")
|
||||
.succeeds()
|
||||
.stdout_contains("dir2\n");
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_realpath_logical_mode() {
|
||||
let scene = TestScenario::new(util_name!());
|
||||
let at = &scene.fixtures;
|
||||
|
||||
at.mkdir("dir1");
|
||||
at.mkdir("dir2");
|
||||
at.symlink_dir("dir2", "dir1/foo");
|
||||
|
||||
scene
|
||||
.ucmd()
|
||||
.arg("-L")
|
||||
.arg("dir1/foo/..")
|
||||
.succeeds()
|
||||
.stdout_contains("dir1\n");
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue