From 95732b497d12c98613bb3c5db16b61f377501a59 Mon Sep 17 00:00:00 2001 From: Jari Aalto Date: Wed, 7 Dec 2005 14:08:12 +0000 Subject: Imported from ../bash-3.1.tar.gz. --- tests/array.tests | 64 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+) (limited to 'tests/array.tests') diff --git a/tests/array.tests b/tests/array.tests index 4f5d830..4a735d8 100644 --- a/tests/array.tests +++ b/tests/array.tests @@ -236,7 +236,12 @@ echo "value = ${barray[*]}" set -u ( echo ${#narray[4]} ) +${THIS_SH} ./array1.sub +${THIS_SH} ./array2.sub + # some old bugs and ksh93 compatibility tests +${THIS_SH} ./array3.sub + set +u cd /tmp @@ -332,3 +337,62 @@ echo ${av[@]: -1:2} echo out-of-range offset echo ${av[@]:12} + +# parsing problems and other inconsistencies not fixed until post bash-3.0 +unset x +declare -a x=(')' $$) +[ ${x[1]} -eq $$ ] || echo bad + +unset x +declare -a x=(a b c d e) +echo ${x[4]} + +z=([1]=one [4]=four [7]=seven [10]=ten) + +echo ${#z[@]} + +echo ${!z[@]} + +unset x +declare -a x=(a \'b c\') + +echo "${x[1]}" + +unset x +declare -a x=(a 'b c') + +echo "${x[1]}" + +unset x +declare -a x=($0) +[ "${x[@]}" = $0 ] || echo double expansion of \$0 +declare -a x=(\$0) +echo "${x[@]}" + +: ${TMPDIR:=/tmp} + +mkdir $TMPDIR/bash-test-$$ +cd $TMPDIR/bash-test-$$ + +trap "cd / ; rm -rf $TMPDIR/bash-test-$$" 0 1 2 3 6 15 + +touch '[3]=abcde' + +touch r s t u v + +declare -a x=(*) + +echo ${x[3]} +echo ${x[@]} + +unset x +x=(a b c d e) + +echo ${x[*]: -1} + +unset x[4] +unset x[2] + +x[9]='9' + +echo ${x[*]: -1} -- cgit v1.2.3