test: add string operators added by POSIX 2024

* src/test.c (binop): Recognize the ">" and "<" operators.
(three_arguments): Likewise.
(binary_operator): Implement the "<" and ">" operators.
(usage): Add operators to --help output.
* tests/test/test.pl (@Tests): Add functionality tests.
* doc/coreutils.texi (test invocation, String tests): Document new
operators.
* NEWS: Mention the new feature.
This commit is contained in:
Collin Funk
2024-11-01 20:49:16 -07:00
committed by Pádraig Brady
parent f48123ef27
commit ee231019e1
4 changed files with 42 additions and 4 deletions

View File

@@ -13733,7 +13733,7 @@ Exit status:
* File type tests:: @code{-[bcdfhLpSt]}
* Access permission tests:: @code{-[gkruwxOG]}
* File characteristic tests:: @code{-e -s -nt -ot -ef}
* String tests:: @code{-z -n = == !=}
* String tests:: @code{-z -n = == != > <}
* Numeric tests:: @code{-eq -ne -lt -le -gt -ge}
* Connectives for test:: @code{! -a -o}
@end menu
@@ -13942,6 +13942,16 @@ shells and systems.
@cindex not-equal string check
True if the strings are not equal.
@item @var{string1} > @var{string2}
@opindex >
@cindex greater-than string check
True if @var{string1} is greater than @var{string2} in the current locale.
@item @var{string1} < @var{string2}
@opindex <
@cindex less-than string check
True if @var{string1} is less than @var{string2} in the current locale.
@end table