]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: ls: verify in-group ordering with --group-directories-first
authorSylvestre Ledru <sylvestre@debian.org>
Sun, 24 May 2026 15:51:11 +0000 (17:51 +0200)
committerPádraig Brady <P@draigBrady.com>
Fri, 29 May 2026 18:29:10 +0000 (19:29 +0100)
* tests/ls/group-dirs.sh: Check that entries within each group remain
alphabetically sorted, and that equal-size files keep a deterministic
order when combined with --sort=size.
https://github.com/uutils/coreutils/issues/11997
https://github.com/coreutils/coreutils/pull/267

tests/ls/group-dirs.sh

index 372587483abe3b3637d7e34e877f78d7b15fc796..bcd3bd703e34c7bfa5c9aae6642250b08aab9219 100755 (executable)
@@ -40,4 +40,24 @@ dir/a
 EOF
 compare exp out || fail=1
 
+# Ensure entries within each group remain alphabetically sorted, and
+# that equal-size files keep a deterministic (by-name) order when
+# combined with --sort=size.
+mkdir dir2 dir2/dir_b dir2/dir_a dir2/dir_c || framework_failure_
+touch dir2/file_c dir2/file_a dir2/file_b || framework_failure_
+
+ls --group-directories-first dir2 > out || fail=1
+cat <<\EOF > exp
+dir_a
+dir_b
+dir_c
+file_a
+file_b
+file_c
+EOF
+compare exp out || fail=1
+
+ls --group-directories-first --sort=size dir2 > out || fail=1
+compare exp out || fail=1
+
 Exit $fail