mirror of
https://github.com/RGBCube/uutils-coreutils
synced 2025-07-28 03:27:44 +00:00
ls: Fix padding for dangling links in non-Long formats (#2856)
* Fix padding for dangling links in non-long formats Co-authored-by: electricboogie <32370782+electricboogie@users.noreply.github.com>
This commit is contained in:
parent
f60c36f242
commit
016d5e72ad
2 changed files with 53 additions and 6 deletions
|
@ -2457,6 +2457,36 @@ fn test_ls_dangling_symlinks() {
|
|||
.arg("temp_dir")
|
||||
.fails()
|
||||
.stdout_contains("l?????????");
|
||||
|
||||
#[cfg(unix)]
|
||||
{
|
||||
// Check padding is the same for real files and dangling links, in non-long formats
|
||||
at.touch("temp_dir/real_file");
|
||||
|
||||
let real_file_res = scene.ucmd().arg("-Li1").arg("temp_dir").fails();
|
||||
let real_file_stdout_len = String::from_utf8(real_file_res.stdout().to_owned())
|
||||
.ok()
|
||||
.unwrap()
|
||||
.lines()
|
||||
.nth(1)
|
||||
.unwrap()
|
||||
.strip_suffix("real_file")
|
||||
.unwrap()
|
||||
.len();
|
||||
|
||||
let dangle_file_res = scene.ucmd().arg("-Li1").arg("temp_dir").fails();
|
||||
let dangle_stdout_len = String::from_utf8(dangle_file_res.stdout().to_owned())
|
||||
.ok()
|
||||
.unwrap()
|
||||
.lines()
|
||||
.next()
|
||||
.unwrap()
|
||||
.strip_suffix("dangle")
|
||||
.unwrap()
|
||||
.len();
|
||||
|
||||
assert_eq!(real_file_stdout_len, dangle_stdout_len);
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue