1
0
Fork 0
mirror of git://git.code.sf.net/p/cdesktopenv/code synced 2025-03-09 15:50:02 +00:00

tests/arrays.sh: fix running with xtrace

This commit is contained in:
Martijn Dekker 2021-03-05 21:54:46 +00:00
parent 7a0934a8d6
commit 2215e036d4

View file

@ -226,13 +226,14 @@ if [[ ${!xxx[@]} ]]
then err_exit '${!xxx[@]} should be null'
fi
integer i=0
[[ -o xtrace ]] && was_xtrace=1 || was_xtrace=0
{
set -x
xxx[++i]=1
set +x
((!was_xtrace)) && set +x
} 2> /dev/null
if (( i != 1))
then err_exit 'execution trace side effects with array subscripts'
then err_exit "execution trace side effects with array subscripts (expected '1', got '$i')"
fi
unset list
: $(set -A list foo bar)