]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
tests: sort: cover punctuation weight in locale collation
authorSylvestre Ledru <sylvestre@debian.org>
Sun, 7 Jun 2026 09:58:49 +0000 (11:58 +0200)
committerPádraig Brady <P@draigBrady.com>
Tue, 9 Jun 2026 13:08:02 +0000 (14:08 +0100)
* tests/sort/sort-locale.sh: In a UTF-8 locale '-' carries a minimal
(shifted) weight, so 'file1' sorts before 'file-2' even though '-'
precedes '1' in the C/byte order.  This is the opposite of the C locale
result, so it also exercises the differs-from-C path.
Identified here: https://github.com/uutils/coreutils/pull/12677
Closes https://github.com/coreutils/coreutils/pull/283

tests/sort/sort-locale.sh

index 18c591abd3a341685bc3d1d3d4a6299123370163..ab71ae0dce35fe992285cd3123bbaf0734e72b9f 100755 (executable)
@@ -46,6 +46,9 @@ export LC_ALL=$LOCALE_FR_UTF8
 if test "$(locale charmap 2>/dev/null)" = UTF-8; then
   check_hard_collate 'aaé' 'aaf'  # é comes before f
   check_hard_collate 'aéY' "$(printf 'ae\314\201Z')"  # NFC/NFD é are equal
+  check_hard_collate 'file1' 'file-2'  # '-' has a minimal weight, so the
+                                       # digits decide: file1 before file-2,
+                                       # the opposite of the C/byte order
 fi
 
 Exit $fail