From 7fc96f7961ec44a2dae33face111b0a464c2ec33 Mon Sep 17 00:00:00 2001 From: Chet Ramey Date: Thu, 29 Dec 2011 13:09:08 -0500 Subject: [PATCH] commit bash-20110608 snapshot --- MANIFEST | 1 + tests/RUN-ONE-TEST | 2 +- tests/array.right | 8 ++++++++ tests/array.tests | 2 ++ tests/array11.sub | 29 +++++++++++++++++++++++++++++ 5 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 tests/array11.sub diff --git a/MANIFEST b/MANIFEST index e3817787c..ce0fb9311 100644 --- a/MANIFEST +++ b/MANIFEST @@ -772,6 +772,7 @@ tests/array7.sub f tests/array8.sub f tests/array9.sub f tests/array10.sub f +tests/array11.sub f tests/array-at-star f tests/array2.right f tests/assoc.tests f diff --git a/tests/RUN-ONE-TEST b/tests/RUN-ONE-TEST index 72ec06a2c..3efcf32d6 100755 --- a/tests/RUN-ONE-TEST +++ b/tests/RUN-ONE-TEST @@ -1,4 +1,4 @@ -BUILD_DIR=/usr/local/build/bash/bash-current +BUILD_DIR=/usr/local/build/chet/bash/bash-current THIS_SH=$BUILD_DIR/bash PATH=$PATH:$BUILD_DIR diff --git a/tests/array.right b/tests/array.right index 94c64a747..9df235fcd 100644 --- a/tests/array.right +++ b/tests/array.right @@ -341,3 +341,11 @@ ednesday onday uesday ednesday +version[agent] +version.agent +version[agent] +version.agent +version[agent] foo[bar] +version.agent bowl +foobar] foo foo[bar] +bleh bbb bleh diff --git a/tests/array.tests b/tests/array.tests index 3b6996d36..88d12e3a9 100644 --- a/tests/array.tests +++ b/tests/array.tests @@ -388,3 +388,5 @@ ${THIS_SH} ./array8.sub ${THIS_SH} ./array9.sub ${THIS_SH} ./array10.sub + +${THIS_SH} ./array11.sub diff --git a/tests/array11.sub b/tests/array11.sub new file mode 100644 index 000000000..87cf01152 --- /dev/null +++ b/tests/array11.sub @@ -0,0 +1,29 @@ +# problems with associative array keys with ] and unbalanced [ ] +# fixed after bash-4.2 + +declare -A foo + +foo=(["version[agent]"]=version.agent) + +echo ${!foo[@]} +echo ${foo[@]} + +unset foo +declare -A foo +foo["version[agent]"]=version.agent + +echo ${!foo[@]} +echo ${foo[@]} + +declare foo["foo[bar]"]=bowl + +echo ${!foo[@]} +echo ${foo[@]} + +declare -A array2["foo[bar]"]=bleh + +array2["foobar]"]=bleh +array2["foo"]=bbb + +echo ${!array2[@]} +echo ${array2[@]} -- 2.47.2