summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2018-11-23 15:32:57 -0500
committerChet Ramey <chet.ramey@case.edu>2018-11-23 15:32:57 -0500
commit2ae59c1134a75d5778997b7202b15b0586283042 (patch)
tree6a0fa496d41b222f5f69e3640d84932fb7a84778 /tests
parent2f5dfe5a18b4670eb4cea32c1c76295eb70a8865 (diff)
downloadbash-5.0-beta2.tar.gz
bash-5.0-beta2 releasebash-5.0-beta2
Diffstat (limited to 'tests')
-rw-r--r--tests/array.right59
-rw-r--r--tests/array.tests1
-rw-r--r--tests/array22.sub12
-rw-r--r--tests/array23.sub6
-rw-r--r--tests/array27.sub59
-rw-r--r--tests/case.tests1
-rw-r--r--tests/case4.sub25
-rw-r--r--tests/errors.right10
-rw-r--r--tests/exec.right6
-rw-r--r--tests/exec12.sub3
-rw-r--r--tests/glob.tests2
-rw-r--r--tests/new-exp.right4
-rw-r--r--tests/new-exp10.sub14
-rw-r--r--tests/posixexp1.sub8
-rw-r--r--tests/procsub.tests18
-rw-r--r--tests/redir.right17
-rw-r--r--tests/redir11.sub19
-rw-r--r--tests/redir5.sub4
-rw-r--r--tests/run-glob-test7
-rw-r--r--tests/run-nquote48
-rw-r--r--tests/shopt.right6
-rw-r--r--tests/vredir.right3
-rw-r--r--tests/vredir.tests6
23 files changed, 231 insertions, 67 deletions
diff --git a/tests/array.right b/tests/array.right
index 3c465248..ff0c3dd2 100644
--- a/tests/array.right
+++ b/tests/array.right
@@ -49,7 +49,7 @@ declare -a f=([0]="" [1]="bdef" [2]="hello world" [3]="test" [4]="ninth element"
./array.tests: line 103: a: readonly variable
./array.tests: line 105: b[]: bad array subscript
./array.tests: line 106: b[*]: bad array subscript
-./array.tests: line 107: ${b[ ]}: bad substitution
+this
./array.tests: line 109: c[-2]: bad array subscript
./array.tests: line 110: c: bad array subscript
@@ -506,7 +506,8 @@ a1
argv[1] = <>
argv[2] = <>
a2
-argv[1] = <>
+argv[1] = <y>
+argv[1] = <z>
a3
argv[1] = <>
argv[2] = <x>
@@ -520,6 +521,8 @@ argv[1] = <>
argv[2] = <x>
p3
argv[1] = <y>
+<X> <X> <X> <X>
+<X> <X> <X> <X>
./array23.sub: line 9: $( echo >&2 foo ) : syntax error: operand expected (error token is "$( echo >&2 foo ) ")
./array23.sub: line 10: $( echo >&2 foo ) : syntax error: operand expected (error token is "$( echo >&2 foo ) ")
foo
@@ -530,6 +533,9 @@ foo
6
./array23.sub: line 21: $( echo >&2 foo ): syntax error: operand expected (error token is "$( echo >&2 foo )")
./array23.sub: line 22: $( echo >&2 foo ): syntax error: operand expected (error token is "$( echo >&2 foo )")
+0
+0
+0
IFS=: ${var-$*}
abc
def ghi
@@ -579,9 +585,9 @@ def ghi
jkl
1. indexed:
reference:
-./array25.sub: line 10: ${a[ ]}: bad substitution
+1. 0
./array25.sub: line 11: ' ': syntax error: operand expected (error token is "' '")
-./array25.sub: line 12: ${a[ ]}: bad substitution
+3. 0
4. 0
5. 0
6. 0
@@ -591,19 +597,19 @@ assignment:
3.declare -a a=([0]="12" [1]="1")
4.declare -a a=([0]="13" [1]="1")
arithmetic:
-1.declare -a a=([0]="0" [1]="1")
-2.declare -a a=([0]="0" [1]="1")
-3.declare -a a=([0]="0" [1]="1")
-4.declare -a a=([0]="0" [1]="1")
-5.declare -a a=([0]="0" [1]="1")
+1.declare -a a=([0]="10" [1]="1")
+2.declare -a a=([0]="11" [1]="1")
+3.declare -a a=([0]="12" [1]="1")
+4.declare -a a=([0]="13" [1]="1")
+5.declare -a a=([0]="10" [1]="1")
6.declare -a a=([0]="11" [1]="1")
-7.declare -a a=([0]="0" [1]="1")
+7.declare -a a=([0]="12" [1]="1")
8.declare -a a=([0]="13" [1]="1")
2. associative:
reference:
-./array25.sub: line 47: ${a[ ]}: bad substitution
+1.
2.
-./array25.sub: line 49: ${a[ ]}: bad substitution
+3.
4.
5.
6.
@@ -613,14 +619,14 @@ assignment:
3.declare -A a=([" "]="12" [0]="0" [1]="1" )
4.declare -A a=([" "]="13" [0]="0" [1]="1" )
arithmetic:
-1.declare -A a=([" "]="13" [0]="0" [1]="1" )
-2.declare -A a=([" "]="13" [0]="0" [1]="1" )
-3.declare -A a=([" "]="13" [0]="0" [1]="1" )
+1.declare -A a=([" "]="10" [0]="0" [1]="1" )
+2.declare -A a=([" "]="11" [0]="0" [1]="1" )
+3.declare -A a=([" "]="12" [0]="0" [1]="1" )
4.declare -A a=([" "]="13" [0]="0" [1]="1" )
-5.declare -A a=([" "]="13" [0]="0" [1]="1" )
-6.declare -A a=([" "]="13" [0]="0" [1]="1" ["\" \""]="11" )
-7.declare -A a=([" "]="13" [0]="0" [1]="1" ["\" \""]="11" )
-8.declare -A a=([" "]="13" [0]="0" [1]="1" ["\" \""]="13" )
+5.declare -A a=([" "]="10" [0]="0" [1]="1" )
+6.declare -A a=([" "]="10" [0]="0" [1]="1" ["\" \""]="11" )
+7.declare -A a=([" "]="12" [0]="0" [1]="1" ["\" \""]="11" )
+8.declare -A a=([" "]="12" [0]="0" [1]="1" ["\" \""]="13" )
argv[1] = <aa>
argv[2] = <bb>
argv[1] = <aa>
@@ -741,3 +747,18 @@ argv[2] = <b>
argv[1] = <a>
argv[2] = <b>
argv[1] = <a+b>
+7
+./array27.sub: line 11: a[]]=7 : syntax error: invalid arithmetic operator (error token is "]=7 ")
+declare -A A=([$'\t']="2" [" "]="2" )
+./array27.sub: line 23: ((: A[]]=2 : syntax error: invalid arithmetic operator (error token is "]=2 ")
+declare -A A=([$'\t']="2" [" "]="2" ["*"]="2" ["@"]="2" )
+./array27.sub: line 32: A[]]: bad array subscript
+declare -A A=([$'\t']="X" [" "]="X" ["*"]="X" ["@"]="X" )
+./array27.sub: line 40: A[]]: bad array subscript
+declare -A A=([$'\t']="X" [" "]="X" ["*"]="X" ["@"]="X" )
+./array27.sub: line 48: declare: `A[]]=X': not a valid identifier
+declare -A A=(["*"]="X" ["@"]="X" )
+./array27.sub: line 56: declare: `A[]]=X': not a valid identifier
+./array27.sub: line 56: A[*]: bad array subscript
+./array27.sub: line 56: A[@]: bad array subscript
+declare -A A
diff --git a/tests/array.tests b/tests/array.tests
index 7fa1cdaf..afd3df51 100644
--- a/tests/array.tests
+++ b/tests/array.tests
@@ -405,3 +405,4 @@ ${THIS_SH} ./array23.sub
${THIS_SH} ./array24.sub
${THIS_SH} ./array25.sub
${THIS_SH} ./array26.sub
+${THIS_SH} ./array27.sub
diff --git a/tests/array22.sub b/tests/array22.sub
index e0463c34..adae6e1a 100644
--- a/tests/array22.sub
+++ b/tests/array22.sub
@@ -7,6 +7,7 @@ unset a
echo a2
a[1]=; recho "${a[@]:-y}"
+a[1]=; recho "${a[*]:-z}"
unset a
echo a3
@@ -32,3 +33,14 @@ shift $#
echo p3
set '' x
recho ${@:+y}
+
+# problems with * and null expansions dating back to bash's earliest days
+A=(''); set -- ''
+
+echo "<${A[*]:-X}>" "<${*:-X}>" "<${A:-X}>" "<${A[0]:-X}>"
+
+IFS=
+A=('' ''); set -- '' ''
+B=''
+
+echo "<${A[*]:-X}>" "<${*:-X}>" "<${B:-X}>" "<${B[*]:-X}>"
diff --git a/tests/array23.sub b/tests/array23.sub
index a762aadb..bd64fe1f 100644
--- a/tests/array23.sub
+++ b/tests/array23.sub
@@ -20,3 +20,9 @@ typeset -a a
echo $((1+a[$index]))
echo $((1+a[\$index]))
echo "1+${a[$index]}"
+
+# intermediate problems discovered while bash-5.0 was in testing
+a=0
+echo $(( a[a[0]] ))
+echo ${a[a[a[0]]]}
+echo $(( a[a[a[0]]] ))
diff --git a/tests/array27.sub b/tests/array27.sub
new file mode 100644
index 00000000..fe1ffd35
--- /dev/null
+++ b/tests/array27.sub
@@ -0,0 +1,59 @@
+# tests for `problem' keys when using associative arrays and assoc_expand_once
+# deal with problems for now; this is a placeholder for if and when I fix them
+
+typeset -A a
+shopt -s assoc_expand_once
+
+k='['
+echo $(( a[$k]=7 ))
+
+k=']'
+echo $(( a[$k]=7 ))
+
+unset a
+
+declare -A A
+
+for k in $'\t' ' '; do
+ (( A[$k]=2 ))
+done
+declare -p A
+
+for k in ']' '*' '@'; do
+ (( A[$k]=2 ))
+done
+
+declare -p A
+
+unset A
+declare -A A
+
+for k in $'\t' ' ' ']' '*' '@'; do
+ read "A[$k]" <<< X
+done
+declare -p A
+
+unset A
+declare -A A
+
+for k in $'\t' ' ' ']' '*' '@'; do
+ printf -v "A[$k]" "%s" X
+done
+declare -p A
+
+unset A
+declare -A A
+
+for k in ']' '*' '@'; do
+ declare A[$k]=X
+done
+declare -p A
+
+unset A
+declare -A A
+
+for k in ']' '*' '@'; do
+ declare "A[$k]=X"
+done
+declare -p A
+
diff --git a/tests/case.tests b/tests/case.tests
index cc73d8e1..fe9c05a7 100644
--- a/tests/case.tests
+++ b/tests/case.tests
@@ -53,3 +53,4 @@ case " " in ( [" "] ) echo ok;; ( * ) echo no;; esac
${THIS_SH} ./case1.sub
${THIS_SH} ./case2.sub
${THIS_SH} ./case3.sub
+${THIS_SH} ./case4.sub
diff --git a/tests/case4.sub b/tests/case4.sub
new file mode 100644
index 00000000..56f88baa
--- /dev/null
+++ b/tests/case4.sub
@@ -0,0 +1,25 @@
+shopt -s -o posix
+two="t w o"
+ten="t e
+n"
+set 1 "$two" 3 4 5 6 7 8 9 "$ten"
+
+unset IFS
+expvar="$*"
+case $* in
+"$expvar") ;;
+*) echo "failed 1" ;;
+esac
+
+case $* in
+$expvar) ;;
+*) echo "failed 2" ;;
+esac
+
+alias foo='oneword'
+foo_word='foo'
+case "$foo_word"
+in
+ foo) ;;
+ *) echo failed 3;;
+esac
diff --git a/tests/errors.right b/tests/errors.right
index 4bf478b0..7627450b 100644
--- a/tests/errors.right
+++ b/tests/errors.right
@@ -126,8 +126,10 @@ after readonly assignment
after 1: 1
after 2: 1
after 3: 1
-array after 1: 1
-array after 2: 1
+4
+array after 1: 0
+
+array after 2: 0
./errors6.sub: uvar: parameter not set
./errors6.sub: uvar: parameter null or not set
@@ -144,6 +146,10 @@ unset
./errors6.sub: line 41: invalid-ident: invalid variable name
./errors6.sub: line 42: invalid-ident: invalid variable name
./errors6.sub: line 43: invalid-ident: invalid variable name
+4
+array after 1: 0
+
+array after 2: 0
./errors6.sub: uvar: parameter not set
./errors6.sub: uvar: parameter null or not set
diff --git a/tests/exec.right b/tests/exec.right
index 81224fa5..6075cc86 100644
--- a/tests/exec.right
+++ b/tests/exec.right
@@ -84,9 +84,9 @@ after
exit code: 1
exit code: 1
exit code: 1
-exit code: 127
-exit code: 127
-exit code: 127
+exit code: 1
+exit code: 1
+exit code: 1
a
b
c
diff --git a/tests/exec12.sub b/tests/exec12.sub
index bc627d2d..79bcfc77 100644
--- a/tests/exec12.sub
+++ b/tests/exec12.sub
@@ -4,7 +4,8 @@ trap 'rm -f $TMPFILE' 0
rm -f $TMPFILE
set -e
-exit_handler() { echo "exit code: $?" ; touch $TMPFILE; }
+# we normalize the exit code to accommodate false returning 255 on Solaris
+exit_handler() { echo "exit code: $(( $? != 0 ))" ; touch $TMPFILE; }
false() { ! :; }
notfound() { nosuchcommand ; }
syntaxerror() { !:; }
diff --git a/tests/glob.tests b/tests/glob.tests
index 7ae51723..cfb086fd 100644
--- a/tests/glob.tests
+++ b/tests/glob.tests
@@ -4,7 +4,7 @@ export LC_COLLATE=C
#
expect()
{
- echo expect "$@"
+: # if needed, change me to echo expect "$@"
}
# First, a test that bash-2.01.1 fails
diff --git a/tests/new-exp.right b/tests/new-exp.right
index 12fc18dd..b2337bd8 100644
--- a/tests/new-exp.right
+++ b/tests/new-exp.right
@@ -643,6 +643,10 @@ ir
a b c d e
5
a5b
+i
+declare -i foo
+A
+declare -A foo
abcxxxdef
abcådef
ḅć
diff --git a/tests/new-exp10.sub b/tests/new-exp10.sub
index e07e5581..9e89a701 100644
--- a/tests/new-exp10.sub
+++ b/tests/new-exp10.sub
@@ -84,3 +84,17 @@ set -- a b c d e
echo ${@}
echo ${#@}
echo a${#@}b
+
+# new feature in bash-5.0: display attributes of even unset variables
+unset -v foo
+
+declare -i foo
+echo ${foo@a}
+
+declare -p foo
+
+unset foo
+declare -A foo
+echo ${foo@a}
+
+declare -p foo
diff --git a/tests/posixexp1.sub b/tests/posixexp1.sub
index ce0b29dc..91718e3d 100644
--- a/tests/posixexp1.sub
+++ b/tests/posixexp1.sub
@@ -27,4 +27,12 @@ ${THIS_SH} -uc 'echo $1' 2>/dev/null && exit 20
${THIS_SH} -uc 'echo $1' ${THIS_SH} xnotthere >/dev/null || exit 21
${THIS_SH} -uc 'echo $2' ${THIS_SH} xnotthere 2>/dev/null && exit 22
${THIS_SH} -uc 'echo $2' ${THIS_SH} xnotthere ynotthere >/dev/null || exit 23
+
+${THIS_SH} -uc 'echo $! ; exit 24' 2>/dev/null
+${THIS_SH} -uc 'echo ${!} ; exit 25' 2>/dev/null
+${THIS_SH} -uc 'echo ${!,} ; exit 26' 2>/dev/null
+
+${THIS_SH} -uc 'echo ${!-ok 27} >/dev/null || exit 27'
+${THIS_SH} -uc 'echo ${2-ok 28} >/dev/null || exit 28'
+
exit 0
diff --git a/tests/procsub.tests b/tests/procsub.tests
index 4678ac69..01ba46a8 100644
--- a/tests/procsub.tests
+++ b/tests/procsub.tests
@@ -68,6 +68,12 @@ unset -f bug
count_lines()
{
wc -l < $1
+
+# case "$1" in
+# *sh-np*) [ -e "$1" ] || { echo 0; echo 0; echo 0; echo 0; return; } ;;
+# *) ;;
+# esac
+
wc -l < $1
wc -l < $1
true | wc -l < $1
@@ -80,12 +86,12 @@ unset -f count_lines
echo extern
FN=$TMPDIR/bashtest-$$
-cat >$FN <<EOF
-wc -l < \$1
-wc -l < \$1
-wc -l < \$1
-true | wc -l < \$1
-wc -l < \$1
+cat >$FN << \EOF
+wc -l < $1
+wc -l < $1
+wc -l < $1
+true | wc -l < $1
+wc -l < $1
EOF
${THIS_SH} -c "source $FN <(date)" | _cut_leading_spaces
diff --git a/tests/redir.right b/tests/redir.right
index 75ed4555..d4ab60d5 100644
--- a/tests/redir.right
+++ b/tests/redir.right
@@ -64,14 +64,14 @@ f
typeset -f f
# make sure it was closed
-read -u 5 foo
+read -u 5 foo 2>&1 | grep -q 'invalid file descriptor'
echo after read
exec 5<&0
exec <&-
-read abcde
+read abcde 2>&1 | grep -q 'read error'
exec 0<&9-
read line
@@ -84,9 +84,7 @@ f ()
echo "$line";
done
}
-./redir5.sub: line 20: read: 5: invalid file descriptor: Bad file descriptor
after read
-./redir5.sub: line 27: read: read error: 0: Bad file descriptor
# tests of ksh93-like dup-and-close redirection operators
/
/
@@ -141,19 +139,10 @@ bix ()
foo
::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
1
-./redir11.sub: line 8: $a: Bad file descriptor
-./redir11.sub: line 9: $(echo $a): Bad file descriptor
7
after: 42
-./redir11.sub: line 24: echo: write error: Bad file descriptor
-./redir11.sub: line 25: echo: write error: Bad file descriptor
-./redir11.sub: line 26: $(a=4 foo): Bad file descriptor
-./redir11.sub: line 27: $(a=4 foo): Bad file descriptor
-./redir11.sub: line 30: $a: Bad file descriptor
-./redir11.sub: line 31: $(echo $a): Bad file descriptor
-./redir11.sub: line 39: $(ss= declare -i ss): ambiguous redirect
+./redir11.sub: line 40: $(ss= declare -i ss): ambiguous redirect
after: 42
a+=3
foo
foo
-./redir11.sub: line 53: $(echo $a): Bad file descriptor
diff --git a/tests/redir11.sub b/tests/redir11.sub
index 59ed493a..a919602c 100644
--- a/tests/redir11.sub
+++ b/tests/redir11.sub
@@ -4,9 +4,10 @@
a=1
a=4 b=7 ss=4 echo $a
+# use grep to avoid differences due to different system error messages
a=42
-a=2 echo foo >&$a
-a=2 echo foo >&$(echo $a)
+a=2 echo foo 2>&1 >&$a | { grep -q '\$a: Bad file' || echo 'redir11 bad 1'; }
+a=2 echo foo 2>&1 >&$(echo $a) | { grep -q 'Bad file' || echo 'redir11 bad 2'; }
foo()
{
@@ -21,14 +22,14 @@ a=4 b=7 foo
echo after: $a
unset a
-a=4 echo foo >&$(foo)
-a=1 echo foo >&$(foo)
-a=1 echo foo >&$(a=4 foo)
-echo foo >&$(a=4 foo)
+a=4 echo foo 2>&1 >&$(foo) | { grep -q 'Bad file' || echo 'redir11 bad 3'; }
+a=1 echo foo 2>&1 >&$(foo) | { grep -q 'Bad file' || echo 'redir11 bad 4'; }
+a=1 echo foo 2>&1 >&$(a=4 foo) | { grep -q 'Bad file' || echo 'redir11 bad 5'; }
+echo foo 2>&1 >&$(a=4 foo) | { grep -q 'Bad file' || echo 'redir11 bad 6'; }
a=42
-a=2 echo foo >&$a
-a=2 echo foo >&$(echo $a)
+a=2 echo foo 2>&1 >&$a | { grep -q 'Bad file' || echo 'redir11 bad 7'; }
+a=2 echo foo 2>&1 >&$(echo $a) | { grep -q 'Bad file' || echo 'redir11 bad 8'; }
unset -f foo
foo()
@@ -50,4 +51,4 @@ a=9 echo foo >&$(echo $a)
a=2
a=9 eval echo foo >&$(echo $a)
a=2
-a=9 eval echo foo '>&$(echo $a)'
+a=9 eval echo foo '2>&1 >&$(echo $a)' | { grep -q 'Bad file' || echo 'redir11 bad 9'; }
diff --git a/tests/redir5.sub b/tests/redir5.sub
index 5d59d39c..ee7b045a 100644
--- a/tests/redir5.sub
+++ b/tests/redir5.sub
@@ -17,14 +17,14 @@ f
typeset -f f
# make sure it was closed
-read -u 5 foo
+read -u 5 foo 2>&1 | grep -q 'invalid file descriptor'
echo after read
exec 5<&0
exec <&-
-read abcde
+read abcde 2>&1 | grep -q 'read error'
exec 0<&9-
read line
diff --git a/tests/run-glob-test b/tests/run-glob-test
index 43aa276f..246501cc 100644
--- a/tests/run-glob-test
+++ b/tests/run-glob-test
@@ -1,4 +1,7 @@
PATH=$PATH:`pwd`
export PATH
-${THIS_SH} ./glob.tests 2>&1 | grep -v '^expect' > ${BASH_TSTOUT}
-diff ${BASH_TSTOUT} glob.right && rm -f ${BASH_TSTOUT}
+
+( diff -a glob.right glob.right >/dev/null 2>&1 ) && AFLAG=-a
+
+${THIS_SH} ./glob.tests > ${BASH_TSTOUT} 2>&1
+diff ${AFLAG} ${BASH_TSTOUT} glob.right && rm -f ${BASH_TSTOUT}
diff --git a/tests/run-nquote4 b/tests/run-nquote4
index 44baac4c..985c3111 100644
--- a/tests/run-nquote4
+++ b/tests/run-nquote4
@@ -1,4 +1,8 @@
+# See whether or not we can use `diff -a'
+( diff -a ./nquote4.right ./nquote4.right >/dev/null 2>&1 ) && AFLAG=-a
+
echo warning: some of these tests will fail if you do not have UTF-8 >&2
echo warning: locales installed on your system >&2
-${THIS_SH} ./nquote4.tests 2>&1 | grep -v '^expect' > ${BASH_TSTOUT}
-diff ${BASH_TSTOUT} nquote4.right && rm -f ${BASH_TSTOUT}
+
+${THIS_SH} ./nquote4.tests > ${BASH_TSTOUT} 2>&1
+diff ${AFLAG} ${BASH_TSTOUT} nquote4.right && rm -f ${BASH_TSTOUT}
diff --git a/tests/shopt.right b/tests/shopt.right
index 64c718c8..08db75f1 100644
--- a/tests/shopt.right
+++ b/tests/shopt.right
@@ -40,6 +40,7 @@ shopt -s interactive_comments
shopt -u lastpipe
shopt -u lithist
shopt -u localvar_inherit
+shopt -u localvar_unset
shopt -u login_shell
shopt -u mailwarn
shopt -u no_empty_cmd_completion
@@ -47,6 +48,7 @@ shopt -u nocaseglob
shopt -u nocasematch
shopt -u nullglob
shopt -s progcomp
+shopt -u progcomp_alias
shopt -s promptvars
shopt -u restricted_shell
shopt -u shift_verbose
@@ -100,12 +102,14 @@ shopt -u inherit_errexit
shopt -u lastpipe
shopt -u lithist
shopt -u localvar_inherit
+shopt -u localvar_unset
shopt -u login_shell
shopt -u mailwarn
shopt -u no_empty_cmd_completion
shopt -u nocaseglob
shopt -u nocasematch
shopt -u nullglob
+shopt -u progcomp_alias
shopt -u restricted_shell
shopt -u shift_verbose
shopt -u xpg_echo
@@ -140,12 +144,14 @@ inherit_errexit off
lastpipe off
lithist off
localvar_inherit off
+localvar_unset off
login_shell off
mailwarn off
no_empty_cmd_completion off
nocaseglob off
nocasematch off
nullglob off
+progcomp_alias off
restricted_shell off
shift_verbose off
xpg_echo off
diff --git a/tests/vredir.right b/tests/vredir.right
index f449ae6f..f4fe0db8 100644
--- a/tests/vredir.right
+++ b/tests/vredir.right
@@ -11,9 +11,6 @@ bar ()
./vredir.tests: line 6: v: readonly variable
./vredir.tests: line 6: v: cannot assign fd to variable
42
-./vredir.tests: line 25: $v: Bad file descriptor
-./vredir.tests: line 26: $v: Bad file descriptor
-./vredir.tests: line 27: $v: Bad file descriptor
bar is a function
bar ()
{
diff --git a/tests/vredir.tests b/tests/vredir.tests
index b81c671c..ce77deb7 100644
--- a/tests/vredir.tests
+++ b/tests/vredir.tests
@@ -22,9 +22,9 @@ exec {v}>&-
readonly v=42
bar
-echo foo 1 >&$v
-echo foo 2 >&$v
-echo foo 3 >&$v
+echo foo 1 2>&1 >&$v | { grep -q '\$v: Bad' || echo 'bad foo 1'; }
+echo foo 2 2>&1 >&$v | { grep -q '\$v: Bad' || echo 'bad foo 2'; }
+echo foo 3 2>&1 >&$v | { grep -q '\$v: Bad' || echo 'bad foo 3'; }
cat $TMPFILE
rm -f $TMPFILE