]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - tests/assoc.tests
bash-5.0 distribution sources and documentation
[thirdparty/bash.git] / tests / assoc.tests
index 32536b8d2ab7b3cc1d5ebde7a76de1df2e359096..84326c9c66a634919522025786fdf0eae8b2089a 100644 (file)
@@ -107,7 +107,7 @@ unset flix wheat
 
 # TEST - index expansion: no word splitting or globbing
 typeset -A wheat
-cd /tmp
+cd ${TMPDIR:=/tmp}
 touch '[sfiri]'
 wheat=([s*]=6 [foo bar]=flix )
 
@@ -174,6 +174,13 @@ T='([a]=1)'
 echo "${T[@]}"
 unset T
 
+# peculiar ksh93 semantics for unsubscripted assoc variable reference
+declare -A T
+T[0]='zero'
+if [ "$T" != "${T[0]}" ]; then
+       echo 'assoc.tests: $T and ${T[0]} mismatch'
+fi
+
 ${THIS_SH} ./assoc1.sub
 
 ${THIS_SH} ./assoc2.sub
@@ -207,3 +214,8 @@ readonly -A assoc
 declare -p assoc
 
 ${THIS_SH} ./assoc8.sub
+
+# new shopt option to prevent multiple expansion of assoc array subscripts
+${THIS_SH} ./assoc9.sub
+
+${THIS_SH} ./assoc10.sub