1 # This program is free software: you can redistribute it and/or modify
2 # it under the terms of the GNU General Public License as published by
3 # the Free Software Foundation, either version 3 of the License, or
4 # (at your option) any later version.
6 # This program is distributed in the hope that it will be useful,
7 # but WITHOUT ANY WARRANTY; without even the implied warranty of
8 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
9 # GNU General Public License for more details.
11 # You should have received a copy of the GNU General Public License
12 # along with this program. If not, see <http://www.gnu.org/licenses/>.
14 r=/; declare -n r ; unset r
15 declare -n r=/ ; unset -n r
16 declare -n r; r=/ ; unset -n r
17 declare -n r; declare r=/ ; unset -n r
18 declare -n r; for r in /; do :; done ; unset -n r
19 declare -n r; select r in /; do :; done <<< 1; echo x; echo $r ; unset -n r
20 declare -n r; ((r=0)) ; unset -n r
21 ((r=0)); declare -n r ; unset -n r
22 r=/ declare -n r ; unset -n r
23 f() { declare -n r; }; r=/ f ; unset r
24 f() { echo $r; }; declare -n r; r=/ f ; unset -n r
25 declare -n r; : ${r:=/} ; unset -n r
26 declare -n r; exec {r}>/dev/null ; unset -n r
27 declare -n r; coproc r { :; }; echo $r ; unset r ; wait
28 declare -r RO=x; r=$RO; declare -n r; x=y; declare -n RO; RO=z; declare -p RO; echo "$RO"
29 s=/; declare -n r=s; declare -n s; echo $r ; unset -n r ; unset -n s
30 declare -n r=s; declare -n s; s=/ ; unset -n r; unset -n s
31 declare -n r; getopts x r -h ; unset r; unset -n r
32 declare -n r; mapfile r < /dev/null ; declare -p r; unset r ; unset -n r
33 mapfile r < /dev/null; declare -n r ; unset r ; unset -n r
34 declare -n r; printf -v r / ; unset -n r
36 declare -n r; r="" ; unset -n r
37 declare -n r="" ; unset -n r
38 declare -n r; : ${r=} ; unset -n r
39 declare -n r; printf -v r '' ; unset -n r
40 r=""; declare -n r ; unset -n r
43 # coproc tests, since coproc sets and unsets variables
45 declare -p ROVAR; coproc ROVAR { :; }; wait; declare -p ROVAR
47 echo ${@:0}; coproc @ { :; }; wait ; echo ${@:0}
49 declare -n ref=x; coproc ref { :; }; wait ; declare -p ref
50 unset -n ref ; unset ref
52 declare -r RO RO_PID; coproc RO { :; }; declare -p RO_PID; wait; declare -p RO RO_PID
54 declare -r RO2=a; declare -n ref_PID=RO2; coproc ref { :; }; wait; declare -p RO2