cmdlineTests: Ensure that leading symbols in names affect the sort order

This commit is contained in:
Kamil Śliwak 2021-11-19 14:30:32 +01:00
parent 4773b0b1e4
commit 72a384f4fe

View File

@ -54,7 +54,7 @@ do
shift shift
;; ;;
*) *)
matching_tests=$(find . -mindepth 1 -maxdepth 1 -type d -name "$1" | cut -c 3- | sort) matching_tests=$(find . -mindepth 1 -maxdepth 1 -type d -name "$1" | cut -c 3- | LC_COLLATE=C sort)
if [[ $matching_tests == "" ]] if [[ $matching_tests == "" ]]
then then
@ -72,7 +72,11 @@ done
if (( ${#selected_tests[@]} == 0 && ${#patterns_with_no_matches[@]} == 0 )) if (( ${#selected_tests[@]} == 0 && ${#patterns_with_no_matches[@]} == 0 ))
then then
selected_tests=(*) # NOTE: We want leading symbols in names to affect the sort order but without
# LC_COLLATE=C sort seems to ignore them.
all_tests=$(echo * | tr '[:space:]' '\n' | LC_COLLATE=C sort)
# shellcheck disable=SC2206 # We do not support test names containing spaces.
selected_tests=($all_tests)
fi fi
popd > /dev/null popd > /dev/null