mirror of
git://git.code.sf.net/p/cdesktopenv/code
synced 2025-03-09 15:50:02 +00:00
tests/variables.sh: Fix locale tests (#247)
src/cmd/ksh93/tests/variables.sh: LC_* error tests: - Since operating systems validate locale strings differently, try a few different bad locale strings to find one that makes setlocale(2) fail, fixing test failures on OpenBSD and Debian. - Restore warning removed inaed5c6d7
, issuing it if none of the bad locale strings produce a diagnostic. - Reenable test for diagnostic message disabled inaed5c6d7
. Co-authored-by: Martijn Dekker <martijn@inlv.org>
This commit is contained in:
parent
113a9392ff
commit
f66a10a8c3
1 changed files with 12 additions and 5 deletions
|
@ -736,15 +736,22 @@ unset r v x
|
|||
)
|
||||
Errors=$? # ensure error count survives subshell
|
||||
(
|
||||
errmsg=$({ LANG=bad_LOCALE; } 2>&1)
|
||||
x=x
|
||||
# $x must be an unknown locale.
|
||||
for x in x x.b@d xx_XX xx_XX.b@d
|
||||
do errmsg=$({ LANG=$x; } 2>&1)
|
||||
[[ -n $errmsg ]] && break
|
||||
done
|
||||
if [[ -z $errmsg ]]
|
||||
then warning "C library does not seem to verify locales: skipping LC_* tests"
|
||||
exit $Errors
|
||||
fi
|
||||
|
||||
for v in LC_ALL LC_CTYPE LC_MESSAGES LC_COLLATE LC_NUMERIC
|
||||
do nameref r=$v
|
||||
unset $v
|
||||
[[ $r ]] && err_exit "unset $v failed -- expected '', got '$r'"
|
||||
# Test disabled: some system libraries do not verify the locale, so no diagnostic is printed.
|
||||
#d=$($SHELL -c "$v=$x" 2>&1)
|
||||
#[[ $d ]] || err_exit "$v=$x failed -- expected locale diagnostic"
|
||||
d=$($SHELL -c "$v=$x" 2>&1)
|
||||
[[ $d ]] || err_exit "$v=$x failed -- expected locale diagnostic"
|
||||
{ g=$( r=$x; print -- $r ); } 2>/dev/null
|
||||
[[ $g == '' ]] || err_exit "$v=$x failed -- expected '', got '$g'"
|
||||
{ g=$( r=C; r=$x; print -- $r ); } 2>/dev/null
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue