diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2021-11-02 15:18:05 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2021-11-02 15:24:35 +0200 |
commit | f500b3274b4c937d315a652aad3bfcdd808b49ec (patch) | |
tree | 551ced41e7912f7a4b71e77c6dc0bdef23f90b76 /tests/function/string | |
parent | c56aa2d2e407bfffc2b62d4bad3a65051f31b80b (diff) |
Add $sort() function
Available overloads:
$sort(<names> [, <flags>])
$sort(<ints> [, <flags>])
$sort(<strings> [, <flags>])
$sort(<paths> [, <flags>])
$sort(<dir_paths> [, <flags>])
The following flag is supported by the all overloads:
dedup - in addition to sorting also remove duplicates
Additionally, the strings overload also support the following flag:
icase - sort ignoring case
Note that on case-insensitive filesystem the paths and dir_paths overload's
order is case-insensitive.
Diffstat (limited to 'tests/function/string')
-rw-r--r-- | tests/function/string/testscript | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/tests/function/string/testscript b/tests/function/string/testscript index 9275fe5..5f80bfe 100644 --- a/tests/function/string/testscript +++ b/tests/function/string/testscript @@ -31,3 +31,11 @@ $* <'print $trim([string] " a ")' >'a' : string $* <'print $string.trim( " a ")' >'a' : untyped } + +: sort +: +{ + $* <'print $sort([strings] a c b a)' >'a a b c' : basics + $* <'print $sort([strings] a c b a, dedup)' >'a b c' : dedup + $* <'print $sort([strings] a C B a, icase)' >'a a B C' : icase +} |