1 # test suite cribbed from ksh93 nameref tests
7 if [[ $one != $2 ]]; then
8 echo "one=$one != 2=$2"
15 typeset -n one=$1 two=$2
17 if [[ $one != $two ]]; then
18 echo "one=$one != two=$two"
54 # XXX - need to see if we can do checks for self-referencing at assignment
56 command typeset -n xx=yy
57 command typeset -n yy=xx
67 # XXX -- another self-referencing error?
68 # ksh93 makes this another invalid self-reference
85 # assignment to a previously-unset variable
94 # simple array references and assignments
115 # should ref at global scope survive call to foobar()?
131 # assignment in a function to something possibly out of scope
139 assignvar lex a b c d e
140 echo "expect <a b c d e>"
143 unset foo bar short long
145 typeset -n foo='x[2]'
147 x=(zero one two three four)
150 echo "expect <zero> <one> <seven> <three> <four>"
156 # make sure nameref to a previously-unset variable creates the variable
160 # make sure they work inside arithmetic expressions
161 unset foo bar ref x xxx
179 # should the reference do immediate evaluation or deferred?
180 set -- one two three four
182 # XXX - what does foo get set to here?
183 typeset -n foo='bar[0]'
192 # Need to add code and tests for nameref to array subscripts
193 bar=(one two three four)
195 typeset -n foo='bar[0]'
196 typeset -n qux='bar[3]'
209 # Need to add code and tests for `for' loop nameref variables
211 echo errors = $errors