1
Fork 0
mirror of https://github.com/RGBCube/uutils-coreutils synced 2025-09-15 11:36:16 +00:00

Merge pull request #4954 from Skryptonyte/ls_sortwidth

ls: Implement new sort option --sort=width
This commit is contained in:
Daniel Hofstetter 2023-06-06 18:46:54 +02:00 committed by GitHub
commit 0128198a99
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 33 additions and 3 deletions

View file

@ -1,4 +1,4 @@
// spell-checker:ignore (words) READMECAREFULLY birthtime doesntexist oneline somebackup lrwx somefile somegroup somehiddenbackup somehiddenfile tabsize aaaaaaaa bbbb cccc dddddddd ncccc
// spell-checker:ignore (words) READMECAREFULLY birthtime doesntexist oneline somebackup lrwx somefile somegroup somehiddenbackup somehiddenfile tabsize aaaaaaaa bbbb cccc dddddddd ncccc neee naaaaa nbcdef nfffff
#[cfg(any(unix, feature = "feat_selinux"))]
use crate::common::util::expected_result;
@ -1564,6 +1564,28 @@ fn test_ls_sort_name() {
.stdout_is(".a\n.b\na\nb\n");
}
#[test]
fn test_ls_sort_width() {
let scene = TestScenario::new(util_name!());
let at = &scene.fixtures;
at.touch("aaaaa");
at.touch("bbb");
at.touch("cccc");
at.touch("eee");
at.touch("d");
at.touch("fffff");
at.touch("abc");
at.touch("zz");
at.touch("bcdef");
scene
.ucmd()
.arg("--sort=width")
.succeeds()
.stdout_is("d\nzz\nabc\nbbb\neee\ncccc\naaaaa\nbcdef\nfffff\n");
}
#[test]
fn test_ls_order_size() {
let scene = TestScenario::new(util_name!());