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
88 # assignment to a previously-unset variable
98 # simple array references and assignments
120 # should ref at global scope survive call to foobar()?
136 # assignment in a function to something possibly out of scope
144 assignvar lex a b c d e
145 echo "expect <a b c d e>"
148 unset foo bar short long
150 typeset -n foo='x[2]'
152 x=(zero one two three four)
155 echo "expect <zero> <one> <seven> <three> <four>"
163 # make sure nameref to a previously-unset variable creates the variable
167 # make sure they work inside arithmetic expressions
168 unset foo bar ref x xxx
188 # should the reference do immediate evaluation or deferred?
189 set -- one two three four
191 # XXX - what does foo get set to here?
192 typeset -n foo='bar[0]'
201 # Need to add code and tests for nameref to array subscripts
202 bar=(one two three four)
204 typeset -n foo='bar[0]'
205 typeset -n qux='bar[3]'
218 # Need to add code and tests for `for' loop nameref variables
220 echo errors = $errors