summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorChet Ramey <chet.ramey@case.edu>2018-12-20 11:41:58 -0500
committerChet Ramey <chet.ramey@case.edu>2018-12-20 11:41:58 -0500
commitf250956cb2a8dca13fc0242affc225f9d6983604 (patch)
tree2df8e15963af786dc8efed1c91c4d823a3bf05bb /tests
parent2ae59c1134a75d5778997b7202b15b0586283042 (diff)
downloadbash-5.0-testing.tar.gz
bash-5.0-rc1 releasebash-5.0-rc1bash-5.0-testing
Diffstat (limited to 'tests')
-rw-r--r--tests/array.right88
-rw-r--r--tests/assoc.right170
-rw-r--r--tests/casemod.right8
-rw-r--r--tests/exp.right8
-rw-r--r--tests/exp7.sub12
-rw-r--r--tests/new-exp.right26
-rw-r--r--tests/new-exp.tests4
-rw-r--r--tests/varenv.right4
-rw-r--r--tests/version5
-rw-r--r--tests/version.mini5
10 files changed, 180 insertions, 150 deletions
diff --git a/tests/array.right b/tests/array.right
index ff0c3dd2..3986ac86 100644
--- a/tests/array.right
+++ b/tests/array.right
@@ -446,7 +446,7 @@ declare -a a=([0]="1" [1]="2" [2]="3")
declare -A a=()
declare -- a="([0]=a [1]=b)"
declare -a a=([0]="a" [1]="b")
-declare -A a=([0]="a" [1]="b" )
+declare -A a=([1]="b" [0]="a" )
declare -a var=([0]="[\$(echo" [1]="total" [2]="0)]=1" [3]="[2]=2]")
declare -a var=([0]="[\$(echo total 0)]=1 [2]=2]")
declare -a var=([0]="[\$(echo" [1]="total" [2]="0)]=1" [3]="[2]=2]")
@@ -614,19 +614,19 @@ reference:
5.
6.
assignment:
-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" )
+1.declare -A a=([1]="1" [0]="0" [" "]="10" )
+2.declare -A a=([1]="1" [0]="0" [" "]="11" )
+3.declare -A a=([1]="1" [0]="0" [" "]="12" )
+4.declare -A a=([1]="1" [0]="0" [" "]="13" )
arithmetic:
-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=([" "]="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" )
+1.declare -A a=([1]="1" [0]="0" [" "]="10" )
+2.declare -A a=([1]="1" [0]="0" [" "]="11" )
+3.declare -A a=([1]="1" [0]="0" [" "]="12" )
+4.declare -A a=([1]="1" [0]="0" [" "]="13" )
+5.declare -A a=([1]="1" [0]="0" [" "]="10" )
+6.declare -A a=([1]="1" [0]="0" [" "]="10" ["\" \""]="11" )
+7.declare -A a=([1]="1" [0]="0" [" "]="12" ["\" \""]="11" )
+8.declare -A a=([1]="1" [0]="0" [" "]="12" ["\" \""]="13" )
argv[1] = <aa>
argv[2] = <bb>
argv[1] = <aa>
@@ -665,13 +665,13 @@ argv[1] = <xa+bb>
argv[1] = <xa+bb>
argv[1] = <xa+bb>
argv[2] = <xa+bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa+bb>
+argv[1] = <bb>
+argv[2] = <xa>
+argv[1] = <bb>
+argv[2] = <xa>
+argv[1] = <bb>
+argv[2] = <xa>
+argv[1] = <bb+xa>
argv[1] = <xa>
argv[2] = <bb>
argv[1] = <xa>
@@ -688,13 +688,13 @@ argv[1] = <xabb>
argv[1] = <xabb>
argv[1] = <xabb>
argv[2] = <xabb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xa>
-argv[2] = <bb>
-argv[1] = <xabb>
+argv[1] = <bb>
+argv[2] = <xa>
+argv[1] = <bb>
+argv[2] = <xa>
+argv[1] = <bb>
+argv[2] = <xa>
+argv[1] = <bbxa>
argv[1] = <aa>
argv[2] = <bb>
argv[1] = <aa>
@@ -719,13 +719,13 @@ argv[1] = <aa>
argv[2] = <bb>
argv[3] = <aa>
argv[4] = <bb>
-argv[1] = <aa>
-argv[2] = <bb>
-argv[1] = <aa>
-argv[2] = <bb>
-argv[1] = <aa>
-argv[2] = <bb>
-argv[1] = <aa+bb>
+argv[1] = <bb>
+argv[2] = <aa>
+argv[1] = <bb>
+argv[2] = <aa>
+argv[1] = <bb>
+argv[2] = <aa>
+argv[1] = <bb+aa>
argv[1] = <a>
argv[2] = <b>
argv[1] = <a>
@@ -740,22 +740,22 @@ argv[1] = <a>
argv[2] = <b>
argv[3] = <a>
argv[4] = <b>
-argv[1] = <a>
-argv[2] = <b>
-argv[1] = <a>
-argv[2] = <b>
-argv[1] = <a>
-argv[2] = <b>
-argv[1] = <a+b>
+argv[1] = <b>
+argv[2] = <a>
+argv[1] = <b>
+argv[2] = <a>
+argv[1] = <b>
+argv[2] = <a>
+argv[1] = <b+a>
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" )
+declare -A A=([$'\t']="2" ["*"]="2" [" "]="2" ["@"]="2" )
./array27.sub: line 32: A[]]: bad array subscript
-declare -A A=([$'\t']="X" [" "]="X" ["*"]="X" ["@"]="X" )
+declare -A A=([$'\t']="X" ["*"]="X" [" "]="X" ["@"]="X" )
./array27.sub: line 40: A[]]: bad array subscript
-declare -A A=([$'\t']="X" [" "]="X" ["*"]="X" ["@"]="X" )
+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
diff --git a/tests/assoc.right b/tests/assoc.right
index 99143f00..90abb6d6 100644
--- a/tests/assoc.right
+++ b/tests/assoc.right
@@ -3,43 +3,43 @@ declare -A BASH_CMDS=()
declare -A fluff
declare -A BASH_ALIASES=()
declare -A BASH_CMDS=()
-declare -A fluff=([bar]="two" [foo]="one" )
-declare -A fluff=([bar]="two" [foo]="one" )
+declare -A fluff=([foo]="one" [bar]="two" )
+declare -A fluff=([foo]="one" [bar]="two" )
declare -A fluff=([bar]="two" )
declare -A fluff=([bar]="newval" [qux]="assigned" )
./assoc.tests: line 26: chaff: four: must use subscript when assigning associative array
declare -A BASH_ALIASES=()
declare -A BASH_CMDS=()
-declare -Ai chaff=([one]="10" [zero]="5" )
-declare -Ar waste=([version]="4.0-devel" [source]="./assoc.tests" [lineno]="28" [pid]="42134" )
-declare -A wheat=([two]="b" [three]="c" [one]="a" [zero]="0" )
-declare -A chaff=([one]="10" ["hello world"]="flip" [zero]="5" )
+declare -Ai chaff=([zero]="5" [one]="10" )
+declare -Ar waste=([lineno]="28" [source]="./assoc.tests" [version]="4.0-devel" [pid]="42134" )
+declare -A wheat=([two]="b" [three]="c" [zero]="0" [one]="a" )
+declare -A chaff=(["hello world"]="flip" [zero]="5" [one]="10" )
./assoc.tests: line 38: waste: readonly variable
./assoc.tests: line 39: unset: waste: cannot unset: readonly variable
./assoc.tests: line 40: chaff[*]: bad array subscript
./assoc.tests: line 41: [*]=12: invalid associative array key
-declare -A chaff=([one]="a" ["hello world"]="flip" )
+declare -A chaff=(["hello world"]="flip" [one]="a" )
flip
-argv[1] = <a>
+argv[1] = <multiple>
+argv[2] = <words>
+argv[3] = <flip>
+argv[4] = <a>
+argv[1] = <multiple words>
argv[2] = <flip>
-argv[3] = <multiple>
-argv[4] = <words>
-argv[1] = <a>
-argv[2] = <flip>
-argv[3] = <multiple words>
-argv[1] = <a>
-argv[2] = <flip>
-argv[3] = <multiple>
-argv[4] = <words>
-argv[1] = <a flip multiple words>
+argv[3] = <a>
+argv[1] = <multiple>
+argv[2] = <words>
+argv[3] = <flip>
+argv[4] = <a>
+argv[1] = <multiple words flip a>
./assoc.tests: line 58: declare: chaff: cannot destroy array variables in this way
./assoc.tests: line 60: chaff[*]: bad array subscript
./assoc.tests: line 61: [*]=12: invalid associative array key
-declare -A wheat=([six]="6" ["foo bar"]="qux qix" )
+declare -A wheat=(["foo bar"]="qux qix" [six]="6" )
argv[1] = <qux>
argv[2] = <qix>
argv[1] = <qux qix>
-declare -A wheat=([six]="6" ["foo bar"]="qux qix" )
+declare -A wheat=(["foo bar"]="qux qix" [six]="6" )
argv[1] = <2>
argv[1] = <7>
argv[1] = <qux>
@@ -48,16 +48,16 @@ argv[3] = <blat>
argv[1] = <qux qix blat>
argv[1] = <16>
argv[1] = <16>
-argv[1] = <6>
-argv[2] = <flix>
-argv[1] = <six>
-argv[2] = <foo>
-argv[3] = <bar>
-argv[1] = <six>
-argv[2] = <foo bar>
+argv[1] = <flix>
+argv[2] = <6>
+argv[1] = <foo>
+argv[2] = <bar>
+argv[3] = <six>
+argv[1] = <foo bar>
+argv[2] = <six>
8
-. /sbin /usr/bin /bin /usr/ucb /usr/local/bin /bin /usr/sbin
-. sbin bin bin ucb bin bin sbin
+/sbin /usr/bin /bin /usr/ucb /usr/local/bin . /usr/sbin /bin
+sbin bin bin ucb bin . sbin bin
bin
/ / / / / / /
/
@@ -66,83 +66,83 @@ argv[1] = </>
argv[1] = <sbin>
argv[1] = </>
8
-. /sbin /usr/bin /bin /usr/ucb /usr/local/bin /bin /usr/sbin
-. sbin bin bin ucb bin bin sbin
+/sbin /usr/bin /bin /usr/ucb /usr/local/bin . /usr/sbin /bin
+sbin bin bin ucb bin . sbin bin
/ / / / / / /
8
4 -- /bin
-. ^sbin ^usr^bin ^bin ^usr^ucb ^usr^local^bin ^bin ^usr^sbin
-. ^sbin ^usr^bin ^bin ^usr^ucb ^usr^local^bin ^bin ^usr^sbin
-. \sbin \usr/bin \bin \usr/ucb \usr/local/bin \bin \usr/sbin
-. \sbin \usr\bin \bin \usr\ucb \usr\local\bin \bin \usr\sbin
-. \sbin \usr\bin \bin \usr\ucb \usr\local\bin \bin \usr\sbin
+^sbin ^usr^bin ^bin ^usr^ucb ^usr^local^bin . ^usr^sbin ^bin
+^sbin ^usr^bin ^bin ^usr^ucb ^usr^local^bin . ^usr^sbin ^bin
+\sbin \usr/bin \bin \usr/ucb \usr/local/bin . \usr/sbin \bin
+\sbin \usr\bin \bin \usr\ucb \usr\local\bin . \usr\sbin \bin
+\sbin \usr\bin \bin \usr\ucb \usr\local\bin . \usr\sbin \bin
([a]=1)
-qux foo
-/usr/local/bin/qux /usr/sbin/foo
+foo qux
+/usr/sbin/foo /usr/local/bin/qux
hits command
0 /sbin/blat
- 0 /usr/local/bin/qux
- 0 /bin/sh
0 /usr/sbin/foo
-blat qux sh foo
-/sbin/blat /usr/local/bin/qux /bin/sh /usr/sbin/foo
+ 0 /bin/sh
+ 0 /usr/local/bin/qux
+blat foo sh qux
+/sbin/blat /usr/sbin/foo /bin/sh /usr/local/bin/qux
-qux foo
-argv[1] = </usr/local/bin/qux>
-argv[2] = <-l>
-argv[3] = </usr/sbin/foo>
+foo qux
+argv[1] = </usr/sbin/foo>
+argv[2] = </usr/local/bin/qux>
+argv[3] = <-l>
alias blat='cd /blat ; echo $PWD'
alias foo='/usr/sbin/foo'
alias qux='/usr/local/bin/qux -l'
alias sh='/bin/bash --login -o posix'
-blat qux sh foo
+blat foo sh qux
argv[1] = <cd /blat ; echo $PWD>
-argv[2] = </usr/local/bin/qux -l>
+argv[2] = </usr/sbin/foo>
argv[3] = </bin/bash --login -o posix>
-argv[4] = </usr/sbin/foo>
+argv[4] = </usr/local/bin/qux -l>
outside: outside
declare -A BASH_ALIASES=()
declare -A BASH_CMDS=()
-declare -A afoo=([six]="six" ["foo bar"]="foo quux" )
+declare -A afoo=(["foo bar"]="foo quux" [six]="six" )
argv[1] = <inside:>
-argv[2] = <six>
-argv[3] = <foo quux>
+argv[2] = <foo quux>
+argv[3] = <six>
outside 2: outside
-argv[1] = <fooq//barq/>
-argv[1] = <fooq>
-argv[2] = <>
-argv[3] = <barq>
-argv[4] = <>
-argv[1] = <foo!//bar!/>
-argv[1] = <foo!>
-argv[2] = <>
-argv[3] = <bar!>
-argv[4] = <>
-argv[1] = <ooq//arq/>
-argv[1] = <ooq>
-argv[2] = <>
-argv[3] = <arq>
-argv[4] = <>
-argv[1] = <Fooq//Barq/>
-argv[1] = <Fooq>
-argv[2] = <>
-argv[3] = <Barq>
-argv[4] = <>
-argv[1] = <FOOQ//BARQ/>
-argv[1] = <FOOQ>
-argv[2] = <>
-argv[3] = <BARQ>
-argv[4] = <>
+argv[1] = </barq//fooq>
+argv[1] = <>
+argv[2] = <barq>
+argv[3] = <>
+argv[4] = <fooq>
+argv[1] = </bar!//foo!>
+argv[1] = <>
+argv[2] = <bar!>
+argv[3] = <>
+argv[4] = <foo!>
+argv[1] = </arq//ooq>
+argv[1] = <>
+argv[2] = <arq>
+argv[3] = <>
+argv[4] = <ooq>
+argv[1] = </Barq//Fooq>
+argv[1] = <>
+argv[2] = <Barq>
+argv[3] = <>
+argv[4] = <Fooq>
+argv[1] = </BARQ//FOOQ>
+argv[1] = <>
+argv[2] = <BARQ>
+argv[3] = <>
+argv[4] = <FOOQ>
abc
def
def
./assoc5.sub: line 13: declare: `myarray[foo[bar]=bleh': not a valid identifier
-bleh abc def
-myarray=(["a]=test1;#a"]="123" [foo]="bleh" ["a]a"]="abc" ["]"]="def" )
+bleh def abc
+myarray=([foo]="bleh" ["]"]="def" ["a]=test1;#a"]="123" ["a]a"]="abc" )
123
-myarray=(["a]=test1;#a"]="123" [foo]="bleh" ["a]a"]="abc" ["a]=test2;#a"]="def" ["]"]="def" )
+myarray=([foo]="bleh" ["]"]="def" ["a]=test2;#a"]="def" ["a]=test1;#a"]="123" ["a]a"]="abc" )
bar"bie
doll
declare -A foo=(["bar\"bie"]="doll" )
@@ -195,15 +195,15 @@ declare -A assoc=([0]="assoc" )
assoc
declare -A assoc=([two]="twoless" [three]="three" [one]="onemore" )
declare -Ar assoc=([two]="twoless" [three]="three" [one]="onemore" )
-declare -A b=(["\""]="" [")"]="" ["\\"]="" ["]"]="" ["\`"]="" )
+declare -A b=([")"]="" ["\""]="" ["]"]="" ["\\"]="" ["\`"]="" )
declare -A b=(["]"]="" ["\`"]="" )
-declare -A dict=(["\""]="1" ["'"]="3" ["\\"]="4" ["\`"]="2" )
-./assoc9.sub: line 23: unset: `dict["]': not a valid identifier
+declare -A dict=(["'"]="3" ["\""]="1" ["\\"]="4" ["\`"]="2" )
./assoc9.sub: line 23: unset: `dict[']': not a valid identifier
+./assoc9.sub: line 23: unset: `dict["]': not a valid identifier
./assoc9.sub: line 23: unset: `dict[\]': not a valid identifier
./assoc9.sub: line 23: unset: `dict[`]': not a valid identifier
-declare -A dict=(["\""]="1" ["'"]="3" ["\\"]="4" ["\`"]="2" )
-declare -A dict=(["\""]="1" ["'"]="3" ["\\"]="4" ["\`"]="2" )
+declare -A dict=(["'"]="3" ["\""]="1" ["\\"]="4" ["\`"]="2" )
+declare -A dict=(["'"]="3" ["\""]="1" ["\\"]="4" ["\`"]="2" )
declare -A dict=()
4
4
diff --git a/tests/casemod.right b/tests/casemod.right
index ca1de49a..a5840171 100644
--- a/tests/casemod.right
+++ b/tests/casemod.right
@@ -13,10 +13,10 @@ aCKNOWLEDGEMENT oENOPHILE
aCKNoWLeDGeMeNT oeNoPHiLe
aCKNOWLEDGEMENT oENOPHILE
acknowledgement oenophile
-Acknowledgement Oenophile
-ACKNOWLEDGEMENT OENOPHILE
-Acknowledgement Oenophile
-AcknOwlEdgEmEnt OEnOphIlE
+Oenophile Acknowledgement
+OENOPHILE ACKNOWLEDGEMENT
+Oenophile Acknowledgement
+OEnOphIlE AcknOwlEdgEmEnt
oENOPHILE aCKNOWLEDGEMENT
oenophile acknowledgement
oENOPHILE aCKNOWLEDGEMENT
diff --git a/tests/exp.right b/tests/exp.right
index 599482a7..a2dc86f9 100644
--- a/tests/exp.right
+++ b/tests/exp.right
@@ -210,14 +210,18 @@ argv[1] = <correct>
argv[2] = <a>
argv[1] = <correct>
argv[2] = <a>
-./exp7.sub: line 5: INFORM: dequote_string: string with bare CTLESC
argv[1] = <^A>
argv[1] = <3>
argv[2] = <^C>
argv[3] = <^C>
argv[4] = <^C>
-./exp7.sub: line 10: INFORM: dequote_string: string with bare CTLESC
argv[1] = <^A>
+argv[1] = <XY>
+argv[2] = <YX>
+argv[1] = <XY^AYX>
+argv[1] = <XY>
+argv[2] = <Y>
+argv[1] = <XY^AY>
argv[1] = <x^Ay^?z>
argv[1] = <x^Ay^?z>
declare -- var="xyz"
diff --git a/tests/exp7.sub b/tests/exp7.sub
index 0a4acc3c..f3f3b6bd 100644
--- a/tests/exp7.sub
+++ b/tests/exp7.sub
@@ -9,3 +9,15 @@ recho $# "$1" "$2" "$3"
x=$c
recho "$x"
+
+unset c c2 x
+
+c=$'Y\1Y';
+
+v=X${c}X;
+recho X${c}X
+recho "$v"
+
+v=X$c
+recho X$c
+recho "$v"
diff --git a/tests/new-exp.right b/tests/new-exp.right
index b2337bd8..c0f78fbb 100644
--- a/tests/new-exp.right
+++ b/tests/new-exp.right
@@ -3,7 +3,7 @@ argv[1] = <foo>
argv[1] = </usr/homes/chet>
argv[1] = </usr/homes/chet>
argv[1] = </usr/homes/chet>
-./new-exp.tests: line 24: HOME: }: syntax error: operand expected (error token is "}")
+./new-exp.tests: line 28: HOME: }: syntax error: operand expected (error token is "}")
unset
argv[1] = </usr/homes/chet>
argv[1] = </usr/homes/chet>
@@ -66,8 +66,8 @@ argv[4] = <d>
argv[1] = <a>
argv[2] = <b c>
argv[3] = <d>
-./new-exp.tests: line 180: ABX: unbound variable
-./new-exp.tests: line 184: $6: cannot assign in this way
+./new-exp.tests: line 184: ABX: unbound variable
+./new-exp.tests: line 188: $6: cannot assign in this way
argv[1] = <xxcde>
argv[1] = <axxde>
argv[1] = <abxyz>
@@ -176,7 +176,7 @@ a
./new-exp2.sub: line 49: 1111111111111111111111: command not found
argv[1] = <6>
-./new-exp.tests: line 285: ${#:}: bad substitution
+./new-exp.tests: line 289: ${#:}: bad substitution
argv[1] = <'>
argv[1] = <">
argv[1] = <"hello">
@@ -411,13 +411,13 @@ argv[6] = <w>
argv[7] = <x>
argv[8] = <y>
argv[9] = <z>
-./new-exp.tests: line 503: $9: unbound variable
-./new-exp.tests: line 504: 9: unbound variable
-./new-exp.tests: line 505: UNSET: unbound variable
-./new-exp.tests: line 506: UNSET: unbound variable
-./new-exp.tests: line 507: UNSET: unbound variable
-./new-exp.tests: line 508: UNSET: unbound variable
+./new-exp.tests: line 507: $9: unbound variable
+./new-exp.tests: line 508: 9: unbound variable
./new-exp.tests: line 509: UNSET: unbound variable
+./new-exp.tests: line 510: UNSET: unbound variable
+./new-exp.tests: line 511: UNSET: unbound variable
+./new-exp.tests: line 512: UNSET: unbound variable
+./new-exp.tests: line 513: UNSET: unbound variable
argv[1] = <5>
argv[1] = <#>
argv[1] = <#>
@@ -464,7 +464,7 @@ Case05---3---A:B:C---
Case06---1---A B C::---
Case07---3---A:B:C---
Case08---3---A:B:C---
-./new-exp.tests: line 529: ${$(($#-1))}: bad substitution
+./new-exp.tests: line 533: ${$(($#-1))}: bad substitution
argv[1] = <a>
argv[2] = <b>
argv[3] = <c>
@@ -481,7 +481,7 @@ argv[1] = <a>
argv[1] = <a>
argv[2] = <b>
argv[1] = <>
-./new-exp.tests: line 548: $(($# - 2)): substring expression < 0
+./new-exp.tests: line 552: $(($# - 2)): substring expression < 0
argv[1] = <bin>
argv[2] = <bin>
argv[3] = <ucb>
@@ -669,4 +669,4 @@ prependå
ḅć
argv[1] = </>
argv[1] = </>
-./new-exp.tests: line 611: ABXD: parameter unset
+./new-exp.tests: line 615: ABXD: parameter unset
diff --git a/tests/new-exp.tests b/tests/new-exp.tests
index 31e15468..557d6b44 100644
--- a/tests/new-exp.tests
+++ b/tests/new-exp.tests
@@ -1,3 +1,7 @@
+if (( $UID == 0 )); then
+ echo "new-exp.tests: the test suite should not be run as root" >&2
+fi
+
# must do this because posix mode causes process substitution to be disabled
# and flagged as a syntax error, which causes the shell to exit
set +o posix
diff --git a/tests/varenv.right b/tests/varenv.right
index 4e8c0d16..159a8773 100644
--- a/tests/varenv.right
+++ b/tests/varenv.right
@@ -130,9 +130,9 @@ func: null or unset
after func: x = outside
./varenv11.sub: line 4: local: qux: readonly variable
./varenv11.sub: line 5: qux: readonly variable
-declare -A foo=([one]="one" [zero]="zero" )
+declare -A foo=([zero]="zero" [one]="one" )
declare -a bar=([0]="zero" [1]="one")
-declare -A foo=([one]="one" [zero]="zero" )
+declare -A foo=([zero]="zero" [one]="one" )
declare -a bar=([0]="zero" [1]="one")
./varenv11.sub: line 29: a: readonly variable
foo=abc
diff --git a/tests/version b/tests/version
index bd740205..9ad08f7d 100644
--- a/tests/version
+++ b/tests/version
@@ -1,3 +1,8 @@
+if (( $UID == 0 )); then
+ echo "${THIS_SH}: the test suite should not be run as root" >&2
+ echo
+fi
+
echo Testing ${THIS_SH}
echo version: $BASH_VERSION
diff --git a/tests/version.mini b/tests/version.mini
index 72e4bf96..637565ea 100644
--- a/tests/version.mini
+++ b/tests/version.mini
@@ -1,3 +1,8 @@
+if (( $UID == 0 )); then
+ echo "${THIS_SH}: the test suite should not be run as root" >&2
+ echo
+fi
+
echo Testing ${THIS_SH}
echo version: $BASH_VERSION