mirror of
https://github.com/nushell/nushell.git
synced 2025-08-09 07:55:59 +02:00
make ls -lf
outputs full path in symbolic target (#13605)
# Description Fixes: #13479 # User-Facing Changes Given the following setup: ``` cd /tmp touch src_file.txt ln -s src_file.txt link1 ``` ### Before ``` ls -lf link1 | get target.0 # It outputs src_file.txt ``` ### After ``` ls -lf link1 | get target.0 # It outputs /tmp/src_file.txt ``` # Tests + Formatting Added a test for the change
This commit is contained in:
@ -808,3 +808,28 @@ fn list_inside_tilde_glob_metachars_dir() {
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn list_symlink_with_full_path() {
|
||||
Playground::setup("list_symlink_with_full_path", |dirs, sandbox| {
|
||||
sandbox.with_files(&[EmptyFile("test_file.txt")]);
|
||||
|
||||
#[cfg(unix)]
|
||||
let _ = std::os::unix::fs::symlink("test_file.txt", dirs.test().join("test_link1"));
|
||||
#[cfg(windows)]
|
||||
let _ = std::os::windows::fs::symlink_file("test_file.txt", dirs.test().join("test_link1"));
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(),
|
||||
"ls -l test_link1 | get target.0"
|
||||
);
|
||||
assert_eq!(actual.out, "test_file.txt");
|
||||
let actual = nu!(
|
||||
cwd: dirs.test(),
|
||||
"ls -lf test_link1 | get target.0"
|
||||
);
|
||||
assert_eq!(
|
||||
actual.out,
|
||||
dirs.test().join("test_file.txt").to_string_lossy()
|
||||
);
|
||||
})
|
||||
}
|
||||
|
Reference in New Issue
Block a user