1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-02-15 04:32:24 +00:00

tests/basic.sh: fix tests to work with xtrace (re: c5820aab)

This commit is contained in:
Martijn Dekker 2020-07-15 05:02:29 +01:00
parent b1a4131123
commit 45cfecfc1e

View file

@ -558,6 +558,7 @@ $SHELL 2> /dev/null -c $'for i;\ndo :;done' || err_exit 'for i ; <newline> not v
result=$( result=$(
TIMEFORMAT=$'\%3R' TIMEFORMAT=$'\%3R'
redirect 2>&1 redirect 2>&1
set +x
time sleep .002 time sleep .002
) )
case $result in case $result in
@ -574,6 +575,7 @@ expect='0%'
actual=$( actual=$(
TIMEFORMAT=$'%0S%' TIMEFORMAT=$'%0S%'
redirect 2>&1 redirect 2>&1
set +x
time : time :
) )
[[ $actual == "$expect" ]] || err_exit "'%' is not treated literally when placed after a format specifier" \ [[ $actual == "$expect" ]] || err_exit "'%' is not treated literally when placed after a format specifier" \
@ -584,12 +586,14 @@ us=$(
LC_ALL='C.UTF-8' # radix point '.' LC_ALL='C.UTF-8' # radix point '.'
TIMEFORMAT='%1U' # catch -1.99 bug as well by getting user time TIMEFORMAT='%1U' # catch -1.99 bug as well by getting user time
redirect 2>&1 redirect 2>&1
set +x
time sleep 0 time sleep 0
) )
eu=$( eu=$(
LC_ALL='C_EU.UTF-8' # radix point ',' LC_ALL='C_EU.UTF-8' # radix point ','
TIMEFORMAT='%1U' TIMEFORMAT='%1U'
redirect 2>&1 redirect 2>&1
set +x
time sleep 0 time sleep 0
) )
[[ ${us:1:1} == ${eu:1:1} ]] && err_exit "The time keyword ignores the locale's radix point (both are ${eu:1:1})" [[ ${us:1:1} == ${eu:1:1} ]] && err_exit "The time keyword ignores the locale's radix point (both are ${eu:1:1})"