From 782219ffa2c6cc20c87d1e804a2b7e5f64920271 Mon Sep 17 00:00:00 2001 From: Sylvestre Ledru Date: Fri, 23 Oct 2026 10:19:10 +0200 Subject: [PATCH] tests: sort: check -b and -M skip only space and tab * tests/sort/sort.pl (@Tests): Add test cases ensuring a leading \f or \r is not skipped by -b or -M, while space and tab still are. https://github.com/uutils/coreutils/pull/15647 Link: https://github.com/coreutils/coreutils/pull/388 --- tests/sort/sort.pl | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/sort/sort.pl b/tests/sort/sort.pl index e8e87b5e1..09b7844a6 100755 --- a/tests/sort/sort.pl +++ b/tests/sort/sort.pl @@ -437,6 +437,13 @@ my @Tests = ['key-own-r-5', '-f -r -k1f', {IN=>"b\na\n"}, {OUT=>"a\nb\n"}], ['key-own-r-6', '-r -n -k1n', {IN=>"10\n2\n"}, {OUT=>"2\n10\n"}], +# Only space and tab are skipped by -b and -M; a leading \f or \r +# stays part of the key. +['nonblank-leading-b1', '-k1b', {IN=>"a\n\fb\n"}, {OUT=>"\fb\na\n"}], +['nonblank-leading-b2', '-k1b', {IN=>"a\n\rb\n"}, {OUT=>"\rb\na\n"}], +['nonblank-leading-M1', '-M', {IN=>"\fFEB\nJAN\n"}, {OUT=>"\fFEB\nJAN\n"}], +['nonblank-leading-M2', '-M', {IN=>"\rFEB\nJAN\n"}, {OUT=>"\rFEB\nJAN\n"}], +['blank-leading-M1', '-M', {IN=>" \tFEB\nJAN\n"}, {OUT=>"JAN\n \tFEB\n"}], ); # Add _POSIX2_VERSION=199209 to the environment of each test