diff options
author | Johnny Jazeix <jazeix@gmail.com> | 2020-04-13 16:26:28 (GMT) |
---|---|---|
committer | Johnny Jazeix <jazeix@gmail.com> | 2020-04-13 16:26:28 (GMT) |
commit | da99eca1e7956e42e88df1b52c322f9c571acddd (patch) | |
tree | a56a4154cfe09f318cbd3b235c22b0378f230d5d /Tests | |
parent | fab932c3cba9423443c7ab25fda3999e4fc4b347 (diff) | |
download | CMake-da99eca1e7956e42e88df1b52c322f9c571acddd.zip CMake-da99eca1e7956e42e88df1b52c322f9c571acddd.tar.gz CMake-da99eca1e7956e42e88df1b52c322f9c571acddd.tar.bz2 |
list: add NATURAL sorting on SORT sub-command
Fixes: #20563
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/CMakeTests/ListTest.cmake.in | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/Tests/CMakeTests/ListTest.cmake.in b/Tests/CMakeTests/ListTest.cmake.in index f517e64..785f41d 100644 --- a/Tests/CMakeTests/ListTest.cmake.in +++ b/Tests/CMakeTests/ListTest.cmake.in @@ -85,6 +85,9 @@ set(result ken bill andy brad) list(SORT result) TEST("SORT result" "andy;bill;brad;ken") +list(SORT result COMPARE NATURAL) +TEST("SORT result COMPARE NATURAL" "andy;bill;brad;ken") + set(result andy bill brad ken) list(REVERSE result) TEST("REVERSE result" "ken;brad;bill;andy") @@ -104,6 +107,26 @@ TEST("REVERSE empty result" "") list(SORT result) TEST("SORT empty result" "") +list(SORT result COMPARE NATURAL) +TEST("SORT result COMPARE NATURAL" "") + +set(result 1.1 10.0 11.0 12.0 12.1 2.0 2.1 3.0 3.1 3.2 8.0 9.0) + +list(SORT result COMPARE NATURAL) +TEST("SORT result COMPARE NATURAL" "1.1;2.0;2.1;3.0;3.1;3.2;8.0;9.0;10.0;11.0;12.0;12.1") + +list(SORT result) +TEST("SORT result" "1.1;10.0;11.0;12.0;12.1;2.0;2.1;3.0;3.1;3.2;8.0;9.0") + +list(SORT result COMPARE NATURAL ORDER DESCENDING) +TEST("SORT result COMPARE NATURAL ORDER DESCENDING" "12.1;12.0;11.0;10.0;9.0;8.0;3.2;3.1;3.0;2.1;2.0;1.1") + +set(result b-1.1 a-10.0 c-2.0 d 1 00 0) + +list(SORT result COMPARE NATURAL) +TEST("SORT result COMPARE NATURAL" "00;0;1;a-10.0;b-1.1;c-2.0;d") + + # these trigger top-level condition foreach(cmd IN ITEMS Append Find Get Insert Length Reverse Remove_At Remove_Duplicates Remove_Item Sort) set(${cmd}-No-Arguments-RESULT 1) |