1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-13 19:52:20 +00:00

Forestall spurious test failures by skipping unavailable locales

src/cmd/ksh93/tests/bracket.sh:
- Read the list of installed locales to ensure the locale to be tested
  actually exists on the system under test.
- Produce a warning diagnostic for skipped locales.
- Additionally test the en_US.ISO8859-1 and en_US.UTF-8 locales.

Co-authored-by: Martijn Dekker <martijn@inlv.org>
This commit is contained in:
Lev Kujawski 2021-02-11 17:00:49 -07:00 committed by Martijn Dekker
parent d5a94b3722
commit 3224b79083

View file

@ -264,8 +264,13 @@ test '(' = ')' && err_exit '"test ( = )" should not be true'
[[ $($SHELL -c 'case F in ~(Eilr)[a-z0-9#]) print ok;;esac' 2> /dev/null) == ok ]] || err_exit '~(Eilr) not working in case command' [[ $($SHELL -c 'case F in ~(Eilr)[a-z0-9#]) print ok;;esac' 2> /dev/null) == ok ]] || err_exit '~(Eilr) not working in case command'
[[ $($SHELL -c "case Q in ~(Fi)q | \$'\E') print ok;;esac" 2> /dev/null) == ok ]] || err_exit '~(Fi)q | \E not working in case command' [[ $($SHELL -c "case Q in ~(Fi)q | \$'\E') print ok;;esac" 2> /dev/null) == ok ]] || err_exit '~(Fi)q | \E not working in case command'
for l in C en_US.ISO8859-15 locales=$'\n'$(command -p locale -a 2>/dev/null)$'\n'
do [[ $($SHELL -c "LC_COLLATE=$l" 2>&1) ]] && continue for l in C en_US.ISO8859-1 en_US.ISO8859-15 en_US.UTF-8
do if [[ ! $locales == *$'\n'"${l}"$'\n'* ]] ||
[[ $("$SHELL" -c "LC_COLLATE=${l}" 2>&1) ]]
then print -u2 "\t${Command}[$LINENO]: warning: cannot test unavailable locale: ${l}"
continue
fi
export LC_COLLATE=$l export LC_COLLATE=$l
set -- \ set -- \
'A' 0 1 1 0 1 1 1 0 0 1 0 0 \ 'A' 0 1 1 0 1 1 1 0 0 1 0 0 \