]> git.ipfire.org Git - thirdparty/bash.git/blobdiff - tests/new-exp.tests
bash-5.1 distribution sources and documentation
[thirdparty/bash.git] / tests / new-exp.tests
index 557d6b44daa12e2850c87e8f7729ad0540917413..079426cb5e2d25b8d758e2c0afbab26097aea3a3 100644 (file)
@@ -1,3 +1,16 @@
+#   This program is free software: you can redistribute it and/or modify
+#   it under the terms of the GNU General Public License as published by
+#   the Free Software Foundation, either version 3 of the License, or
+#   (at your option) any later version.
+#
+#   This program is distributed in the hope that it will be useful,
+#   but WITHOUT ANY WARRANTY; without even the implied warranty of
+#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+#   GNU General Public License for more details.
+#
+#   You should have received a copy of the GNU General Public License
+#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
 if (( $UID == 0 )); then
        echo "new-exp.tests: the test suite should not be run as root" >&2
 fi
@@ -550,6 +563,8 @@ recho "${*:1:0}"
 # this is an error -- negative expression
 set a
 recho ${@:1:$(($# - 2))}
+set a b c d e
+recho ${@: -3:-2}
 
 XPATH=/bin:/usr/bin:/usr/ucb:/usr/local/bin:.:/sbin:/usr/sbin
 set $( IFS=: ; echo $XPATH ) 
@@ -604,12 +619,32 @@ ${THIS_SH} ./new-exp10.sub
 # parameter substring replacement and removal operators with multibyte chars
 ${THIS_SH} ./new-exp11.sub
 
+# indirect expansion with arrays and local variables
+${THIS_SH} ./new-exp12.sub
+
+# more indirect expansion and parameter transformation issues
+${THIS_SH} ./new-exp13.sub
+
+# new K parameter transformation operator
+${THIS_SH} ./new-exp14.sub
+
+# ongoing work with a/A parameter transformations and `nounset'
+${THIS_SH} ./new-exp15.sub
+
 # problems with stray CTLNUL in bash-4.0-alpha
 unset a
 a=/a
 recho "/${a%/*}"
 recho "/${a///a/}"
 
-# this must be last!
+patfunc()
+{
+       echo ${1##*"${1##*}"}
+}
+patfunc foo
+
+# caused core dumps because of bad bracket expression parsing in bash-5.0
+eval : $'${x/#[0\xef\xbf\xbd\\Z[:]]}'
+
 expect $0: 'ABXD: parameter unset'
-recho ${ABXD:?"parameter unset"}
+${THIS_SH} -c 'recho ${ABXD:?"parameter unset"}' $0